| | |
| | | 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.utils.SystemInfoUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | */ |
| | | @Component |
| | | public class SystemInfoTimerTask { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(SystemInfoTimerTask.class); |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | |
| | | Map<String, String> networkInterfaces = SystemInfoUtils.getNetworkInterfaces(); |
| | | redisCatchStorage.addNetInfo(networkInterfaces); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | logger.error("[获取系统信息失败] {}", e.getMessage()); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.genersoft.iot.vmp.common.VersionPo; |
| | | import com.genersoft.iot.vmp.utils.GitUtil; |
| | | import com.genersoft.iot.vmp.utils.JarFileUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | public class VersionInfo { |
| | | |
| | | @Autowired |
| | | VersionConfig config; |
| | | @Autowired |
| | | GitUtil gitUtil; |
| | | @Autowired |
| | | JarFileUtils jarFileUtils; |
| | | |
| | | public VersionPo getVersion() { |
| | | VersionPo versionPo = new VersionPo(); |
| | | Map<String,String> map=jarFileUtils.readJarFile(); |
| | | versionPo.setGIT_Revision(gitUtil.getGitCommitId()); |
| | | versionPo.setCreate_By(map.get("Created-By")); |
| | | versionPo.setGIT_BRANCH(gitUtil.getBranch()); |
| | | versionPo.setGIT_URL(gitUtil.getGitUrl()); |
| | | versionPo.setBUILD_DATE(gitUtil.getBuildDate()); |
| | | versionPo.setArtifactId(config.getArtifactId()); |
| | | versionPo.setGIT_Revision_SHORT(gitUtil.getCommitIdShort()); |
| | | versionPo.setVersion(config.getVersion()); |
| | | versionPo.setProject(config.getDescription()); |
| | | versionPo.setBuild_Jdk(map.get("Build-Jdk")); |
| | | versionPo.setVersion(gitUtil.getBuildVersion()); |
| | | |
| | | return versionPo; |
| | | } |
| | |
| | | } |
| | | // 移除已关闭的连接 |
| | | it.remove(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.sip.ClientTransaction;
|
| | | import javax.sip.Dialog;
|
| | |
|
| | | import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
| | | 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.SsrcTransaction;
|
| | | import com.genersoft.iot.vmp.utils.SerializeUtils;
|
| | | 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.stack.SIPDialog;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.util.ObjectUtils;
|
| | | import org.springframework.util.StringUtils;
|
| | |
|
| | | /**
|
| | | * @description:视频流session管理器,管理视频预览、预览回放的通信句柄
|
| | |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| | | 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.SipStackImpl; |
| | | import gov.nist.javax.sip.message.MessageFactoryImpl; |
| | | import gov.nist.javax.sip.message.SIPRequest; |
| | | import org.slf4j.Logger; |
| | |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.lang.Nullable; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | mediaListManager.removedChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream()); |
| | | try { |
| | | responseAck(serverTransaction, Response.TEMPORARILY_UNAVAILABLE, response.getMsg()); |
| | | } catch (SipException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (InvalidArgumentException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage()); |
| | | } |
| | | } |
| | | }); |
| | |
| | | mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId); |
| | | } |
| | | } |
| | | } catch (InvalidArgumentException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (SipException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (InvalidArgumentException | ParseException | SipException e) { |
| | | logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage()); |
| | | } |
| | | |
| | | |
| | |
| | | // 失败的回复
|
| | | try {
|
| | | responseAck(serverTransaction, eventResult.statusCode, eventResult.msg);
|
| | | } catch (SipException e) {
|
| | | e.printStackTrace();
|
| | | } catch (InvalidArgumentException e) {
|
| | | e.printStackTrace();
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | } catch (SipException | InvalidArgumentException | ParseException e) {
|
| | | logger.error("[命令发送失败] 国标级联 录像控制: {}", e.getMessage());
|
| | | }
|
| | | }, eventResult -> {
|
| | | // 成功的回复
|
| | | try {
|
| | | responseAck(serverTransaction, eventResult.statusCode);
|
| | | } catch (SipException e) {
|
| | | e.printStackTrace();
|
| | | } catch (InvalidArgumentException e) {
|
| | | e.printStackTrace();
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | } catch (SipException | InvalidArgumentException | ParseException e) {
|
| | | logger.error("[命令发送失败] 国标级联 录像控制: {}", e.getMessage());
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | // 回复200 OK |
| | | try { |
| | | responseAck(getServerTransaction(evt), Response.OK); |
| | | } catch (SipException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (InvalidArgumentException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 报警通知回复: {}", e.getMessage()); |
| | | } |
| | | Element deviceIdElement = rootElement.element("DeviceID"); |
| | | String channelId = deviceIdElement.getText().toString(); |
| | |
| | | deviceService.online(device); |
| | | } |
| | | } |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 心跳回复: {}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | // 回复200 OK |
| | | try { |
| | | responseAck(getServerTransaction(evt), Response.OK); |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 录像流推送完毕,回复200OK: {}", e.getMessage()); |
| | | } |
| | | CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME); |
| | | String NotifyType =getText(rootElement, "NotifyType"); |
| | |
| | | logger.info("不支持alarm查询"); |
| | | try { |
| | | responseAck(getServerTransaction(evt), Response.NOT_FOUND, "not support alarm query"); |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 alarm查询回复200OK: {}", e.getMessage()); |
| | | } |
| | | |
| | | } |
| | |
| | | // 回复无通道 |
| | | cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), 0); |
| | | } |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 目录查询: {}", e.getMessage()); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | } catch (ParseException | SipException | InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | logger.error("[命令发送失败] 国标级联 语音喊话: {}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | msg.setKey(key); |
| | | msg.setData(json); |
| | | deferredResultHolder.invokeAllResult(msg); |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 设备配置查询: {}", e.getMessage()); |
| | | } |
| | | |
| | | } |
| | |
| | | msg.setKey(key); |
| | | msg.setData(json); |
| | | deferredResultHolder.invokeAllResult(msg); |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 设备控制: {}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | // 回复200 OK |
| | | try { |
| | | responseAck(getServerTransaction(evt), Response.OK); |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 设备状态应答回复200OK: {}", e.getMessage()); |
| | | } |
| | | Element deviceIdElement = element.element("DeviceID"); |
| | | Element onlineElement = element.element("Online"); |
| | |
| | | } |
| | | } |
| | | } catch (DocumentException e) { |
| | | throw new RuntimeException(e); |
| | | logger.error("xml解析异常: ", e); |
| | | } finally { |
| | | taskQueueHandlerRun = false; |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | } catch (SipException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 国标录像: {}", e.getMessage()); |
| | | } finally { |
| | | taskQueueHandlerRun = false; |
| | | } |
| | | } |
| | |
| | | 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.transmit.SIPProcessorObserver; |
| | | 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.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | @Component |
| | | public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(TimeoutProcessorImpl.class); |
| | | |
| | | @Autowired |
| | | private SIPProcessorObserver processorObserver; |
| | |
| | | sipSubscribe.removeErrorSubscribe(callId); |
| | | sipSubscribe.removeOkSubscribe(callId); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | logger.error("[超时事件失败]: {}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | try { |
| | | gBMap.put(streamPushExcelDto.getApp() + streamPushExcelDto.getStream(), streamPushExcelDto.getGbId()); |
| | | }catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | errorGBList.add(streamPushExcelDto.getGbId() + "(不同的app+stream使用了相同的国标ID)"); |
| | | return; |
| | | } |
| | |
| | | try { |
| | | playMsgCallback.handler(responseSendItemMsg); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | logger.error("[REDIS消息处理异常] ", e); |
| | | } |
| | | } |
| | | break; |
| | |
| | | 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 lat = Double.parseDouble(yy); |
| | | Double[] gcj02 = Coordtransform.WGS84ToGCJ02(lng, lat); |
| | |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | logger.error("[线程休眠失败], {}", e.getMessage()); |
| | | } |
| | | if (useSourceIpAsStreamIp != null && useSourceIpAsStreamIp) { |
| | | String host = request.getHeader("Host"); |