From e272fa26e183f39eae84104023592dad614ebdcb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 07 六月 2023 20:27:57 +0800 Subject: [PATCH] 合并分支 --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java index af31818..b1e2196 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java @@ -29,6 +29,7 @@ import javax.sip.InvalidArgumentException; import javax.sip.SipException; +import javax.sip.SipFactory; import javax.sip.header.CallIdHeader; import javax.sip.header.WWWAuthenticateHeader; import javax.sip.message.Request; @@ -71,23 +72,23 @@ @Override public void register(ParentPlatform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException { - register(parentPlatform, null, null, errorEvent, okEvent, false, true); + register(parentPlatform, null, null, errorEvent, okEvent, true); } @Override public void register(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException { - register(parentPlatform, sipTransactionInfo, null, errorEvent, okEvent, false, true); + register(parentPlatform, sipTransactionInfo, null, errorEvent, okEvent, true); } @Override public void unregister(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException { - register(parentPlatform, sipTransactionInfo, null, errorEvent, okEvent, false, false); + register(parentPlatform, sipTransactionInfo, null, errorEvent, okEvent, false); } @Override public void register(ParentPlatform parentPlatform, @Nullable SipTransactionInfo sipTransactionInfo, @Nullable WWWAuthenticateHeader www, - SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent, boolean registerAgain, boolean isRegister) throws SipException, InvalidArgumentException, ParseException { + SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent, boolean isRegister) throws SipException, InvalidArgumentException, ParseException { Request request; CallIdHeader callIdHeader = sipSender.getNewCallIdHeader(parentPlatform.getDeviceIp(),parentPlatform.getTransport()); @@ -105,10 +106,10 @@ } } - if (!registerAgain ) { + if (www == null ) { request = headerProviderPlatformProvider.createRegisterRequest(parentPlatform, redisCatchStorage.getCSEQ(), fromTag, - toTag, callIdHeader, isRegister); + toTag, callIdHeader, isRegister? parentPlatform.getExpires() : 0); // 灏� callid 鍐欏叆缂撳瓨锛� 绛夋敞鍐屾垚鍔熷彲浠ユ洿鏂扮姸鎬� String callIdFromHeader = callIdHeader.getCallId(); redisCatchStorage.updatePlatformRegisterInfo(callIdFromHeader, PlatformRegisterInfo.getInstance(parentPlatform.getServerGBId(), isRegister)); @@ -126,7 +127,7 @@ }); }else { - request = headerProviderPlatformProvider.createRegisterRequest(parentPlatform, fromTag, toTag, www, callIdHeader, isRegister); + request = headerProviderPlatformProvider.createRegisterRequest(parentPlatform, fromTag, toTag, www, callIdHeader, isRegister? parentPlatform.getExpires() : 0); } sipSender.transmitRequest(parentPlatform.getDeviceIp(), request, null, okEvent); @@ -220,7 +221,7 @@ if (!channel.getChannelId().equals(parentPlatform.getDeviceGBId())) { catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); if (channel.getParental() == 0) { - catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); + catalogXml.append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n"); } } if (channel.getParental() == 0) { @@ -249,7 +250,7 @@ catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); catalogXml.append("<Password>" + channel.getPort() + "</Password>\r\n"); catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); - catalogXml.append("<Status>" + (channel.getStatus() == 1?"ON":"OFF") + "</Status>\r\n"); + catalogXml.append("<Status>" + (channel.isStatus() ? "ON":"OFF") + "</Status>\r\n"); catalogXml.append("<Longitude>" + (channel.getLongitudeWgs84() != 0? channel.getLongitudeWgs84():channel.getLongitude()) + "</Longitude>\r\n"); @@ -376,11 +377,11 @@ * @return */ @Override - public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException { + public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException { if (parentPlatform == null) { return ; } - String statusStr = (status==1)?"ONLINE":"OFFLINE"; + String statusStr = (status)?"ONLINE":"OFFLINE"; String characterSet = parentPlatform.getCharacterSet(); StringBuffer deviceStatusXml = new StringBuffer(600); deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n") @@ -497,10 +498,10 @@ private void sendNotify(ParentPlatform parentPlatform, String catalogXmlContent, SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent ) throws SipException, ParseException, InvalidArgumentException { - MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipLayer.getSipFactory().createMessageFactory(); + MessageFactoryImpl messageFactory = (MessageFactoryImpl) SipFactory.getInstance().createMessageFactory(); String characterSet = parentPlatform.getCharacterSet(); - // 璁剧疆缂栫爜锛� 闃叉涓枃涔辩爜 - messageFactory.setDefaultContentEncodingCharset(characterSet); + // 璁剧疆缂栫爜锛� 闃叉涓枃涔辩爜 + messageFactory.setDefaultContentEncodingCharset(characterSet); SIPRequest notifyRequest = headerProviderPlatformProvider.createNotifyRequest(parentPlatform, catalogXmlContent, subscribeInfo); @@ -541,7 +542,7 @@ catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n") .append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n") .append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n") - .append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); + .append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n"); if (channel.getChannelType() != 2) { // 涓氬姟鍒嗙粍/铏氭嫙缁勭粐/琛屾斂鍖哄垝 涓嶈缃互涓嬪睘鎬� catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n") -- Gitblit v1.8.0