为User-Agent添加必要的版本信息
parent
221f99c764
commit
243edbd143
6
pom.xml
6
pom.xml
|
@ -263,14 +263,16 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- <plugin>
|
<plugin>
|
||||||
<groupId>pl.project13.maven</groupId>
|
<groupId>pl.project13.maven</groupId>
|
||||||
<artifactId>git-commit-id-plugin</artifactId>
|
<artifactId>git-commit-id-plugin</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.0.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<offline>true</offline>
|
<offline>true</offline>
|
||||||
|
<failOnNoGitDirectory>false</failOnNoGitDirectory>
|
||||||
|
<dateFormat>yyyyMMdd</dateFormat>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>-->
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
|
@ -3,6 +3,12 @@ package com.genersoft.iot.vmp;
|
||||||
import java.util.logging.LogManager;
|
import java.util.logging.LogManager;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.druid.EnableDruidSupport;
|
import com.genersoft.iot.vmp.conf.druid.EnableDruidSupport;
|
||||||
|
import com.genersoft.iot.vmp.storager.impl.RedisCatchStorageImpl;
|
||||||
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
|
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
|
@ -17,11 +23,18 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableDruidSupport
|
@EnableDruidSupport
|
||||||
public class VManageBootstrap extends LogManager {
|
public class VManageBootstrap extends LogManager {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(VManageBootstrap.class);
|
||||||
|
|
||||||
private static String[] args;
|
private static String[] args;
|
||||||
private static ConfigurableApplicationContext context;
|
private static ConfigurableApplicationContext context;
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
VManageBootstrap.args = args;
|
VManageBootstrap.args = args;
|
||||||
VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args);
|
VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args);
|
||||||
|
GitUtil gitUtil1 = SpringBeanFactory.getBean("gitUtil");
|
||||||
|
logger.info("构建版本: {}", gitUtil1.getBuildVersion());
|
||||||
|
logger.info("构建时间: {}", gitUtil1.getBuildDate());
|
||||||
|
logger.info("GIT最后提交时间: {}", gitUtil1.getCommitTime());
|
||||||
}
|
}
|
||||||
// 项目重启
|
// 项目重启
|
||||||
public static void restart() {
|
public static void restart() {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -34,6 +35,9 @@ public class SIPRequestHeaderPlarformProvider {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SipFactory sipFactory;
|
private SipFactory sipFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GitUtil gitUtil;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
|
@ -72,8 +76,7 @@ public class SIPRequestHeaderPlarformProvider {
|
||||||
ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(isRegister ? platform.getExpires() : 0);
|
ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(isRegister ? platform.getExpires() : 0);
|
||||||
request.addHeader(expires);
|
request.addHeader(expires);
|
||||||
|
|
||||||
UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory);
|
request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
|
||||||
request.addHeader(userAgentHeader);
|
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
@ -183,6 +186,8 @@ public class SIPRequestHeaderPlarformProvider {
|
||||||
request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
|
request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
|
||||||
toHeader, viaHeaders, maxForwards);
|
toHeader, viaHeaders, maxForwards);
|
||||||
|
|
||||||
|
request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
|
||||||
|
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
||||||
request.setContent(content, contentTypeHeader);
|
request.setContent(content, contentTypeHeader);
|
||||||
return request;
|
return request;
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
import gov.nist.javax.sip.SipProviderImpl;
|
import gov.nist.javax.sip.SipProviderImpl;
|
||||||
import gov.nist.javax.sip.SipStackImpl;
|
import gov.nist.javax.sip.SipStackImpl;
|
||||||
import gov.nist.javax.sip.stack.SIPDialog;
|
import gov.nist.javax.sip.stack.SIPDialog;
|
||||||
|
@ -37,6 +38,9 @@ public class SIPRequestHeaderProvider {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SipFactory sipFactory;
|
private SipFactory sipFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GitUtil gitUtil;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
|
@ -76,6 +80,9 @@ public class SIPRequestHeaderProvider {
|
||||||
|
|
||||||
request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
|
request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
|
||||||
toHeader, viaHeaders, maxForwards);
|
toHeader, viaHeaders, maxForwards);
|
||||||
|
|
||||||
|
request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
|
||||||
|
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
||||||
request.setContent(content, contentTypeHeader);
|
request.setContent(content, contentTypeHeader);
|
||||||
return request;
|
return request;
|
||||||
|
@ -107,6 +114,8 @@ public class SIPRequestHeaderProvider {
|
||||||
CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.INVITE);
|
CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.INVITE);
|
||||||
request = sipFactory.createMessageFactory().createRequest(requestLine, Request.INVITE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
|
request = sipFactory.createMessageFactory().createRequest(requestLine, Request.INVITE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
|
||||||
|
|
||||||
|
request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
|
||||||
|
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||||
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
||||||
request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
||||||
|
@ -146,6 +155,9 @@ public class SIPRequestHeaderProvider {
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||||
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
// Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
||||||
request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
||||||
|
|
||||||
|
request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
|
||||||
|
|
||||||
// Subject
|
// Subject
|
||||||
SubjectHeader subjectHeader = sipFactory.createHeaderFactory().createSubjectHeader(String.format("%s:%s,%s:%s", channelId, ssrc, sipConfig.getId(), 0));
|
SubjectHeader subjectHeader = sipFactory.createHeaderFactory().createSubjectHeader(String.format("%s:%s,%s:%s", channelId, ssrc, sipConfig.getId(), 0));
|
||||||
request.addHeader(subjectHeader);
|
request.addHeader(subjectHeader);
|
||||||
|
@ -180,6 +192,8 @@ public class SIPRequestHeaderProvider {
|
||||||
CallIdHeader callIdHeader = sipFactory.createHeaderFactory().createCallIdHeader(callId);
|
CallIdHeader callIdHeader = sipFactory.createHeaderFactory().createCallIdHeader(callId);
|
||||||
request = sipFactory.createMessageFactory().createRequest(requestLine, Request.BYE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
|
request = sipFactory.createMessageFactory().createRequest(requestLine, Request.BYE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
|
||||||
|
|
||||||
|
request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
|
||||||
|
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
|
@ -230,6 +244,9 @@ public class SIPRequestHeaderProvider {
|
||||||
|
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
||||||
request.setContent(content, contentTypeHeader);
|
request.setContent(content, contentTypeHeader);
|
||||||
|
|
||||||
|
request.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,8 +281,7 @@ public class SIPRequestHeaderProvider {
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory()
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory()
|
||||||
.createSipURI(sipConfig.getId(), sipConfig.getIp() + ":" + sipConfig.getPort()));
|
.createSipURI(sipConfig.getId(), sipConfig.getIp() + ":" + sipConfig.getPort()));
|
||||||
infoRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
infoRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
||||||
UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory);
|
infoRequest.addHeader(SipUtils.createUserAgentHeader(sipFactory, gitUtil));
|
||||||
infoRequest.addHeader(userAgentHeader);
|
|
||||||
|
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application",
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application",
|
||||||
"MANSRTSP");
|
"MANSRTSP");
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
import gov.nist.javax.sip.SipProviderImpl;
|
import gov.nist.javax.sip.SipProviderImpl;
|
||||||
import gov.nist.javax.sip.SipStackImpl;
|
import gov.nist.javax.sip.SipStackImpl;
|
||||||
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
||||||
|
@ -60,6 +61,9 @@ public class SIPCommander implements ISIPCommander {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SipFactory sipFactory;
|
private SipFactory sipFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GitUtil gitUtil;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier(value="tcpSipProvider")
|
@Qualifier(value="tcpSipProvider")
|
||||||
private SipProviderImpl tcpSipProvider;
|
private SipProviderImpl tcpSipProvider;
|
||||||
|
@ -727,7 +731,7 @@ public class SIPCommander implements ISIPCommander {
|
||||||
// 增加Contact header
|
// 增加Contact header
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||||
byeRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
byeRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
||||||
UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory);
|
UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory, gitUtil);
|
||||||
byeRequest.addHeader(userAgentHeader);
|
byeRequest.addHeader(userAgentHeader);
|
||||||
ClientTransaction clientTransaction = null;
|
ClientTransaction clientTransaction = null;
|
||||||
if("TCP".equals(protocol)) {
|
if("TCP".equals(protocol)) {
|
||||||
|
@ -1618,7 +1622,7 @@ public class SIPCommander implements ISIPCommander {
|
||||||
if (request.getHeader(UserAgentHeader.NAME) == null) {
|
if (request.getHeader(UserAgentHeader.NAME) == null) {
|
||||||
UserAgentHeader userAgentHeader = null;
|
UserAgentHeader userAgentHeader = null;
|
||||||
try {
|
try {
|
||||||
userAgentHeader = SipUtils.createUserAgentHeader(sipFactory);
|
userAgentHeader = SipUtils.createUserAgentHeader(sipFactory, gitUtil);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
logger.error("添加UserAgentHeader失败", e);
|
logger.error("添加UserAgentHeader失败", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
import gov.nist.javax.sip.ResponseEventExt;
|
import gov.nist.javax.sip.ResponseEventExt;
|
||||||
import gov.nist.javax.sip.stack.SIPDialog;
|
import gov.nist.javax.sip.stack.SIPDialog;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -48,6 +49,9 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SipFactory sipFactory;
|
private SipFactory sipFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GitUtil gitUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
// 添加消息处理的订阅
|
// 添加消息处理的订阅
|
||||||
|
@ -98,7 +102,7 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract {
|
||||||
}
|
}
|
||||||
requestURI.setPort(event.getRemotePort());
|
requestURI.setPort(event.getRemotePort());
|
||||||
reqAck.setRequestURI(requestURI);
|
reqAck.setRequestURI(requestURI);
|
||||||
UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory);
|
UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory, gitUtil);
|
||||||
reqAck.addHeader(userAgentHeader);
|
reqAck.addHeader(userAgentHeader);
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||||
reqAck.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
reqAck.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.utils;
|
package com.genersoft.iot.vmp.gb28181.utils;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
import gov.nist.javax.sip.address.AddressImpl;
|
import gov.nist.javax.sip.address.AddressImpl;
|
||||||
import gov.nist.javax.sip.address.SipUri;
|
import gov.nist.javax.sip.address.SipUri;
|
||||||
import gov.nist.javax.sip.header.Subject;
|
import gov.nist.javax.sip.header.Subject;
|
||||||
|
@ -49,10 +50,13 @@ public class SipUtils {
|
||||||
return "z9hG4bK" + System.currentTimeMillis();
|
return "z9hG4bK" + System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserAgentHeader createUserAgentHeader(SipFactory sipFactory) throws PeerUnavailableException, ParseException {
|
public static UserAgentHeader createUserAgentHeader(SipFactory sipFactory, GitUtil gitUtil) throws PeerUnavailableException, ParseException {
|
||||||
List<String> agentParam = new ArrayList<>();
|
List<String> agentParam = new ArrayList<>();
|
||||||
agentParam.add("WVP PRO");
|
agentParam.add("WVP-Pro v");
|
||||||
// TODO 添加版本信息以及日期
|
if (gitUtil != null && gitUtil.getCommitTime() != null) {
|
||||||
|
agentParam.add(gitUtil.getBuildVersion() + ".");
|
||||||
|
agentParam.add(gitUtil.getCommitTime());
|
||||||
|
}
|
||||||
return sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
|
return sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,16 @@ public class GitUtil {
|
||||||
private String gitUrl;
|
private String gitUrl;
|
||||||
@Value("${git.build.time:null}")
|
@Value("${git.build.time:null}")
|
||||||
private String buildDate;
|
private String buildDate;
|
||||||
|
|
||||||
|
@Value("${git.build.version:null}")
|
||||||
|
private String buildVersion;
|
||||||
|
|
||||||
@Value("${git.commit.id.abbrev:null}")
|
@Value("${git.commit.id.abbrev:null}")
|
||||||
private String commitIdShort;
|
private String commitIdShort;
|
||||||
|
|
||||||
|
@Value("${git.commit.time:null}")
|
||||||
|
private String commitTime;
|
||||||
|
|
||||||
public String getGitCommitId() {
|
public String getGitCommitId() {
|
||||||
return gitCommitId;
|
return gitCommitId;
|
||||||
}
|
}
|
||||||
|
@ -41,4 +48,12 @@ public class GitUtil {
|
||||||
public String getCommitIdShort() {
|
public String getCommitIdShort() {
|
||||||
return commitIdShort;
|
return commitIdShort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBuildVersion() {
|
||||||
|
return buildVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommitTime() {
|
||||||
|
return commitTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,9 +195,3 @@ springdoc:
|
||||||
enabled: false
|
enabled: false
|
||||||
swagger-ui:
|
swagger-ui:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
# 版本信息, 不需修改
|
|
||||||
version:
|
|
||||||
version: "@project.version@"
|
|
||||||
description: "@project.description@"
|
|
||||||
artifact-id: "@project.artifactId@"
|
|
||||||
|
|
|
@ -84,9 +84,3 @@ media:
|
||||||
# [可选] 日志配置, 一般不需要改
|
# [可选] 日志配置, 一般不需要改
|
||||||
logging:
|
logging:
|
||||||
config: classpath:logback-spring-local.xml
|
config: classpath:logback-spring-local.xml
|
||||||
|
|
||||||
# 版本信息, 不需修改
|
|
||||||
version:
|
|
||||||
version: "@project.version@"
|
|
||||||
description: "@project.description@"
|
|
||||||
artifact-id: "@project.artifactId@"
|
|
||||||
|
|
|
@ -78,10 +78,3 @@ user-settings:
|
||||||
# 推流直播是否录制
|
# 推流直播是否录制
|
||||||
record-push-live: true
|
record-push-live: true
|
||||||
auto-apply-play: true
|
auto-apply-play: true
|
||||||
|
|
||||||
|
|
||||||
# 版本信息, 不需修改
|
|
||||||
version:
|
|
||||||
version: "@project.version@"
|
|
||||||
description: "@project.description@"
|
|
||||||
artifact-id: "@project.artifactId@"
|
|
||||||
|
|
|
@ -5,5 +5,3 @@
|
||||||
\ \ \|\__\_\ \ \ / / \ \ \___\|____________|\ \ \___|\ \ \\ \\ \ \\\ \
|
\ \ \|\__\_\ \ \ / / \ \ \___\|____________|\ \ \___|\ \ \\ \\ \ \\\ \
|
||||||
\ \____________\ \__/ / \ \__\ \ \__\ \ \__\\ _\\ \_______\
|
\ \____________\ \__/ / \ \__\ \ \__\ \ \__\\ _\\ \_______\
|
||||||
\|____________|\|__|/ \|__| \|__| \|__|\|__|\|_______|
|
\|____________|\|__|/ \|__| \|__| \|__|\|__|\|_______|
|
||||||
|
|
||||||
版本:${version.version}
|
|
Loading…
Reference in New Issue