Commit 243edbd14369cf8be80008056320aa809612cdc0

Authored by 648540858
1 parent 221f99c7

为User-Agent添加必要的版本信息

@@ -263,14 +263,16 @@ @@ -263,14 +263,16 @@
263 </configuration> 263 </configuration>
264 </plugin> 264 </plugin>
265 265
266 - <!-- <plugin> 266 + <plugin>
267 <groupId>pl.project13.maven</groupId> 267 <groupId>pl.project13.maven</groupId>
268 <artifactId>git-commit-id-plugin</artifactId> 268 <artifactId>git-commit-id-plugin</artifactId>
269 <version>3.0.1</version> 269 <version>3.0.1</version>
270 <configuration> 270 <configuration>
271 <offline>true</offline> 271 <offline>true</offline>
  272 + <failOnNoGitDirectory>false</failOnNoGitDirectory>
  273 + <dateFormat>yyyyMMdd</dateFormat>
272 </configuration> 274 </configuration>
273 - </plugin>--> 275 + </plugin>
274 276
275 <plugin> 277 <plugin>
276 <groupId>org.apache.maven.plugins</groupId> 278 <groupId>org.apache.maven.plugins</groupId>
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
@@ -3,6 +3,12 @@ package com.genersoft.iot.vmp; @@ -3,6 +3,12 @@ package com.genersoft.iot.vmp;
3 import java.util.logging.LogManager; 3 import java.util.logging.LogManager;
4 4
5 import com.genersoft.iot.vmp.conf.druid.EnableDruidSupport; 5 import com.genersoft.iot.vmp.conf.druid.EnableDruidSupport;
  6 +import com.genersoft.iot.vmp.storager.impl.RedisCatchStorageImpl;
  7 +import com.genersoft.iot.vmp.utils.GitUtil;
  8 +import com.genersoft.iot.vmp.utils.SpringBeanFactory;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.boot.SpringApplication; 12 import org.springframework.boot.SpringApplication;
7 import org.springframework.boot.autoconfigure.SpringBootApplication; 13 import org.springframework.boot.autoconfigure.SpringBootApplication;
8 import org.springframework.boot.web.servlet.ServletComponentScan; 14 import org.springframework.boot.web.servlet.ServletComponentScan;
@@ -17,11 +23,18 @@ import org.springframework.scheduling.annotation.EnableScheduling; @@ -17,11 +23,18 @@ import org.springframework.scheduling.annotation.EnableScheduling;
17 @EnableScheduling 23 @EnableScheduling
18 @EnableDruidSupport 24 @EnableDruidSupport
19 public class VManageBootstrap extends LogManager { 25 public class VManageBootstrap extends LogManager {
  26 +
  27 + private final static Logger logger = LoggerFactory.getLogger(VManageBootstrap.class);
  28 +
20 private static String[] args; 29 private static String[] args;
21 private static ConfigurableApplicationContext context; 30 private static ConfigurableApplicationContext context;
22 public static void main(String[] args) { 31 public static void main(String[] args) {
23 VManageBootstrap.args = args; 32 VManageBootstrap.args = args;
24 VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args); 33 VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args);
  34 + GitUtil gitUtil1 = SpringBeanFactory.getBean("gitUtil");
  35 + logger.info("构建版本: {}", gitUtil1.getBuildVersion());
  36 + logger.info("构建时间: {}", gitUtil1.getBuildDate());
  37 + logger.info("GIT最后提交时间: {}", gitUtil1.getCommitTime());
25 } 38 }
26 // 项目重启 39 // 项目重启
27 public static void restart() { 40 public static void restart() {
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.conf.SipConfig; @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
4 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; 4 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
5 import com.genersoft.iot.vmp.gb28181.utils.SipUtils; 5 import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
6 import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 6 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
  7 +import com.genersoft.iot.vmp.utils.GitUtil;
7 import gov.nist.javax.sip.message.MessageFactoryImpl; 8 import gov.nist.javax.sip.message.MessageFactoryImpl;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
@@ -35,6 +36,9 @@ public class SIPRequestHeaderPlarformProvider { @@ -35,6 +36,9 @@ public class SIPRequestHeaderPlarformProvider {
35 private SipFactory sipFactory; 36 private SipFactory sipFactory;
36 37
37 @Autowired 38 @Autowired
  39 + private GitUtil gitUtil;
  40 +
  41 + @Autowired
38 private IRedisCatchStorage redisCatchStorage; 42 private IRedisCatchStorage redisCatchStorage;
39 43
40 public Request createRegisterRequest(@NotNull ParentPlatform platform, long CSeq, String fromTag, String viaTag, CallIdHeader callIdHeader, boolean isRegister) throws ParseException, InvalidArgumentException, PeerUnavailableException { 44 public Request createRegisterRequest(@NotNull ParentPlatform platform, long CSeq, String fromTag, String viaTag, CallIdHeader callIdHeader, boolean isRegister) throws ParseException, InvalidArgumentException, PeerUnavailableException {
@@ -72,8 +76,7 @@ public class SIPRequestHeaderPlarformProvider { @@ -72,8 +76,7 @@ public class SIPRequestHeaderPlarformProvider {
72 ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(isRegister ? platform.getExpires() : 0); 76 ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(isRegister ? platform.getExpires() : 0);
73 request.addHeader(expires); 77 request.addHeader(expires);
74 78
75 - UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory);  
76 - request.addHeader(userAgentHeader); 79 + request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
77 80
78 return request; 81 return request;
79 } 82 }
@@ -183,6 +186,8 @@ public class SIPRequestHeaderPlarformProvider { @@ -183,6 +186,8 @@ public class SIPRequestHeaderPlarformProvider {
183 request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, 186 request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
184 toHeader, viaHeaders, maxForwards); 187 toHeader, viaHeaders, maxForwards);
185 188
  189 + request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
  190 +
186 ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); 191 ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
187 request.setContent(content, contentTypeHeader); 192 request.setContent(content, contentTypeHeader);
188 return request; 193 return request;
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
@@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.common.StreamInfo; @@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.common.StreamInfo;
13 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; 13 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
14 import com.genersoft.iot.vmp.gb28181.utils.SipUtils; 14 import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
15 import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 15 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
  16 +import com.genersoft.iot.vmp.utils.GitUtil;
16 import gov.nist.javax.sip.SipProviderImpl; 17 import gov.nist.javax.sip.SipProviderImpl;
17 import gov.nist.javax.sip.SipStackImpl; 18 import gov.nist.javax.sip.SipStackImpl;
18 import gov.nist.javax.sip.stack.SIPDialog; 19 import gov.nist.javax.sip.stack.SIPDialog;
@@ -38,6 +39,9 @@ public class SIPRequestHeaderProvider { @@ -38,6 +39,9 @@ public class SIPRequestHeaderProvider {
38 private SipFactory sipFactory; 39 private SipFactory sipFactory;
39 40
40 @Autowired 41 @Autowired
  42 + private GitUtil gitUtil;
  43 +
  44 + @Autowired
41 private IRedisCatchStorage redisCatchStorage; 45 private IRedisCatchStorage redisCatchStorage;
42 46
43 @Autowired 47 @Autowired
@@ -76,6 +80,9 @@ public class SIPRequestHeaderProvider { @@ -76,6 +80,9 @@ public class SIPRequestHeaderProvider {
76 80
77 request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, 81 request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
78 toHeader, viaHeaders, maxForwards); 82 toHeader, viaHeaders, maxForwards);
  83 +
  84 + request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
  85 +
79 ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); 86 ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
80 request.setContent(content, contentTypeHeader); 87 request.setContent(content, contentTypeHeader);
81 return request; 88 return request;
@@ -106,7 +113,9 @@ public class SIPRequestHeaderProvider { @@ -106,7 +113,9 @@ public class SIPRequestHeaderProvider {
106 //ceq 113 //ceq
107 CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.INVITE); 114 CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.INVITE);
108 request = sipFactory.createMessageFactory().createRequest(requestLine, Request.INVITE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards); 115 request = sipFactory.createMessageFactory().createRequest(requestLine, Request.INVITE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
109 - 116 +
  117 + request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
  118 +
110 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort())); 119 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
111 // Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort())); 120 // Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
112 request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); 121 request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
@@ -146,6 +155,9 @@ public class SIPRequestHeaderProvider { @@ -146,6 +155,9 @@ public class SIPRequestHeaderProvider {
146 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort())); 155 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
147 // Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort())); 156 // Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
148 request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); 157 request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
  158 +
  159 + request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
  160 +
149 // Subject 161 // Subject
150 SubjectHeader subjectHeader = sipFactory.createHeaderFactory().createSubjectHeader(String.format("%s:%s,%s:%s", channelId, ssrc, sipConfig.getId(), 0)); 162 SubjectHeader subjectHeader = sipFactory.createHeaderFactory().createSubjectHeader(String.format("%s:%s,%s:%s", channelId, ssrc, sipConfig.getId(), 0));
151 request.addHeader(subjectHeader); 163 request.addHeader(subjectHeader);
@@ -180,6 +192,8 @@ public class SIPRequestHeaderProvider { @@ -180,6 +192,8 @@ public class SIPRequestHeaderProvider {
180 CallIdHeader callIdHeader = sipFactory.createHeaderFactory().createCallIdHeader(callId); 192 CallIdHeader callIdHeader = sipFactory.createHeaderFactory().createCallIdHeader(callId);
181 request = sipFactory.createMessageFactory().createRequest(requestLine, Request.BYE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards); 193 request = sipFactory.createMessageFactory().createRequest(requestLine, Request.BYE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
182 194
  195 + request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
  196 +
183 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort())); 197 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
184 198
185 return request; 199 return request;
@@ -230,6 +244,9 @@ public class SIPRequestHeaderProvider { @@ -230,6 +244,9 @@ public class SIPRequestHeaderProvider {
230 244
231 ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); 245 ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
232 request.setContent(content, contentTypeHeader); 246 request.setContent(content, contentTypeHeader);
  247 +
  248 + request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
  249 +
233 return request; 250 return request;
234 } 251 }
235 252
@@ -264,8 +281,7 @@ public class SIPRequestHeaderProvider { @@ -264,8 +281,7 @@ public class SIPRequestHeaderProvider {
264 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory() 281 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory()
265 .createSipURI(sipConfig.getId(), sipConfig.getIp() + ":" + sipConfig.getPort())); 282 .createSipURI(sipConfig.getId(), sipConfig.getIp() + ":" + sipConfig.getPort()));
266 infoRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); 283 infoRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
267 - UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory);  
268 - infoRequest.addHeader(userAgentHeader); 284 + infoRequest.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
269 285
270 ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", 286 ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application",
271 "MANSRTSP"); 287 "MANSRTSP");
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -21,6 +21,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService; @@ -21,6 +21,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
21 import com.genersoft.iot.vmp.service.bean.SSRCInfo; 21 import com.genersoft.iot.vmp.service.bean.SSRCInfo;
22 import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 22 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
23 import com.genersoft.iot.vmp.storager.IVideoManagerStorage; 23 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  24 +import com.genersoft.iot.vmp.utils.GitUtil;
24 import gov.nist.javax.sip.SipProviderImpl; 25 import gov.nist.javax.sip.SipProviderImpl;
25 import gov.nist.javax.sip.SipStackImpl; 26 import gov.nist.javax.sip.SipStackImpl;
26 import gov.nist.javax.sip.message.MessageFactoryImpl; 27 import gov.nist.javax.sip.message.MessageFactoryImpl;
@@ -61,6 +62,9 @@ public class SIPCommander implements ISIPCommander { @@ -61,6 +62,9 @@ public class SIPCommander implements ISIPCommander {
61 private SipFactory sipFactory; 62 private SipFactory sipFactory;
62 63
63 @Autowired 64 @Autowired
  65 + private GitUtil gitUtil;
  66 +
  67 + @Autowired
64 @Qualifier(value="tcpSipProvider") 68 @Qualifier(value="tcpSipProvider")
65 private SipProviderImpl tcpSipProvider; 69 private SipProviderImpl tcpSipProvider;
66 70
@@ -727,7 +731,7 @@ public class SIPCommander implements ISIPCommander { @@ -727,7 +731,7 @@ public class SIPCommander implements ISIPCommander {
727 // 增加Contact header 731 // 增加Contact header
728 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort())); 732 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
729 byeRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); 733 byeRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
730 - UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory); 734 + UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory, gitUtil);
731 byeRequest.addHeader(userAgentHeader); 735 byeRequest.addHeader(userAgentHeader);
732 ClientTransaction clientTransaction = null; 736 ClientTransaction clientTransaction = null;
733 if("TCP".equals(protocol)) { 737 if("TCP".equals(protocol)) {
@@ -1618,7 +1622,7 @@ public class SIPCommander implements ISIPCommander { @@ -1618,7 +1622,7 @@ public class SIPCommander implements ISIPCommander {
1618 if (request.getHeader(UserAgentHeader.NAME) == null) { 1622 if (request.getHeader(UserAgentHeader.NAME) == null) {
1619 UserAgentHeader userAgentHeader = null; 1623 UserAgentHeader userAgentHeader = null;
1620 try { 1624 try {
1621 - userAgentHeader = SipUtils.createUserAgentHeader(sipFactory); 1625 + userAgentHeader = SipUtils.createUserAgentHeader(sipFactory, gitUtil);
1622 } catch (ParseException e) { 1626 } catch (ParseException e) {
1623 logger.error("添加UserAgentHeader失败", e); 1627 logger.error("添加UserAgentHeader失败", e);
1624 } 1628 }
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/InviteResponseProcessor.java
@@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
5 import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; 5 import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
6 import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract; 6 import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract;
7 import com.genersoft.iot.vmp.gb28181.utils.SipUtils; 7 import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
  8 +import com.genersoft.iot.vmp.utils.GitUtil;
8 import gov.nist.javax.sip.ResponseEventExt; 9 import gov.nist.javax.sip.ResponseEventExt;
9 import gov.nist.javax.sip.stack.SIPDialog; 10 import gov.nist.javax.sip.stack.SIPDialog;
10 import org.slf4j.Logger; 11 import org.slf4j.Logger;
@@ -48,6 +49,9 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract { @@ -48,6 +49,9 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract {
48 @Autowired 49 @Autowired
49 private SipFactory sipFactory; 50 private SipFactory sipFactory;
50 51
  52 + @Autowired
  53 + private GitUtil gitUtil;
  54 +
51 @Override 55 @Override
52 public void afterPropertiesSet() throws Exception { 56 public void afterPropertiesSet() throws Exception {
53 // 添加消息处理的订阅 57 // 添加消息处理的订阅
@@ -98,7 +102,7 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract { @@ -98,7 +102,7 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract {
98 } 102 }
99 requestURI.setPort(event.getRemotePort()); 103 requestURI.setPort(event.getRemotePort());
100 reqAck.setRequestURI(requestURI); 104 reqAck.setRequestURI(requestURI);
101 - UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory); 105 + UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory, gitUtil);
102 reqAck.addHeader(userAgentHeader); 106 reqAck.addHeader(userAgentHeader);
103 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort())); 107 Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
104 reqAck.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); 108 reqAck.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java
1 package com.genersoft.iot.vmp.gb28181.utils; 1 package com.genersoft.iot.vmp.gb28181.utils;
2 2
  3 +import com.genersoft.iot.vmp.utils.GitUtil;
3 import gov.nist.javax.sip.address.AddressImpl; 4 import gov.nist.javax.sip.address.AddressImpl;
4 import gov.nist.javax.sip.address.SipUri; 5 import gov.nist.javax.sip.address.SipUri;
5 import gov.nist.javax.sip.header.Subject; 6 import gov.nist.javax.sip.header.Subject;
@@ -49,10 +50,13 @@ public class SipUtils { @@ -49,10 +50,13 @@ public class SipUtils {
49 return "z9hG4bK" + System.currentTimeMillis(); 50 return "z9hG4bK" + System.currentTimeMillis();
50 } 51 }
51 52
52 - public static UserAgentHeader createUserAgentHeader(SipFactory sipFactory) throws PeerUnavailableException, ParseException { 53 + public static UserAgentHeader createUserAgentHeader(SipFactory sipFactory, GitUtil gitUtil) throws PeerUnavailableException, ParseException {
53 List<String> agentParam = new ArrayList<>(); 54 List<String> agentParam = new ArrayList<>();
54 - agentParam.add("WVP PRO");  
55 - // TODO 添加版本信息以及日期 55 + agentParam.add("WVP-Pro v");
  56 + if (gitUtil != null && gitUtil.getCommitTime() != null) {
  57 + agentParam.add(gitUtil.getBuildVersion() + ".");
  58 + agentParam.add(gitUtil.getCommitTime());
  59 + }
56 return sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); 60 return sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
57 } 61 }
58 62
src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java
@@ -19,9 +19,16 @@ public class GitUtil { @@ -19,9 +19,16 @@ public class GitUtil {
19 private String gitUrl; 19 private String gitUrl;
20 @Value("${git.build.time:null}") 20 @Value("${git.build.time:null}")
21 private String buildDate; 21 private String buildDate;
  22 +
  23 + @Value("${git.build.version:null}")
  24 + private String buildVersion;
  25 +
22 @Value("${git.commit.id.abbrev:null}") 26 @Value("${git.commit.id.abbrev:null}")
23 private String commitIdShort; 27 private String commitIdShort;
24 28
  29 + @Value("${git.commit.time:null}")
  30 + private String commitTime;
  31 +
25 public String getGitCommitId() { 32 public String getGitCommitId() {
26 return gitCommitId; 33 return gitCommitId;
27 } 34 }
@@ -41,4 +48,12 @@ public class GitUtil { @@ -41,4 +48,12 @@ public class GitUtil {
41 public String getCommitIdShort() { 48 public String getCommitIdShort() {
42 return commitIdShort; 49 return commitIdShort;
43 } 50 }
  51 +
  52 + public String getBuildVersion() {
  53 + return buildVersion;
  54 + }
  55 +
  56 + public String getCommitTime() {
  57 + return commitTime;
  58 + }
44 } 59 }
src/main/resources/all-application.yml
@@ -195,9 +195,3 @@ springdoc: @@ -195,9 +195,3 @@ springdoc:
195 enabled: false 195 enabled: false
196 swagger-ui: 196 swagger-ui:
197 enabled: false 197 enabled: false
198 -  
199 -# 版本信息, 不需修改  
200 -version:  
201 - version: "@project.version@"  
202 - description: "@project.description@"  
203 - artifact-id: "@project.artifactId@"  
src/main/resources/application-dev.yml
@@ -84,9 +84,3 @@ media: @@ -84,9 +84,3 @@ media:
84 # [可选] 日志配置, 一般不需要改 84 # [可选] 日志配置, 一般不需要改
85 logging: 85 logging:
86 config: classpath:logback-spring-local.xml 86 config: classpath:logback-spring-local.xml
87 -  
88 -# 版本信息, 不需修改  
89 -version:  
90 - version: "@project.version@"  
91 - description: "@project.description@"  
92 - artifact-id: "@project.artifactId@"  
src/main/resources/application-docker.yml
@@ -78,10 +78,3 @@ user-settings: @@ -78,10 +78,3 @@ user-settings:
78 # 推流直播是否录制 78 # 推流直播是否录制
79 record-push-live: true 79 record-push-live: true
80 auto-apply-play: true 80 auto-apply-play: true
81 -  
82 -  
83 -# 版本信息, 不需修改  
84 -version:  
85 - version: "@project.version@"  
86 - description: "@project.description@"  
87 - artifact-id: "@project.artifactId@"  
src/main/resources/banner.txt
@@ -5,5 +5,3 @@ @@ -5,5 +5,3 @@
5 \ \ \|\__\_\ \ \ / / \ \ \___\|____________|\ \ \___|\ \ \\ \\ \ \\\ \ 5 \ \ \|\__\_\ \ \ / / \ \ \___\|____________|\ \ \___|\ \ \\ \\ \ \\\ \
6 \ \____________\ \__/ / \ \__\ \ \__\ \ \__\\ _\\ \_______\ 6 \ \____________\ \__/ / \ \__\ \ \__\ \ \__\\ _\\ \_______\
7 \|____________|\|__|/ \|__| \|__| \|__|\|__|\|_______| 7 \|____________|\|__|/ \|__| \|__| \|__|\|__|\|_______|
8 -  
9 -版本:${version.version}  
10 \ No newline at end of file 8 \ No newline at end of file