Browse Source

Merge remote-tracking branch 'origin/master' into wvp-28181-2.0

pull/46/head
panlinlin 4 years ago
parent
commit
cf8a22f50b
  1. BIN
      libs/jain-sip-ri-1.3.0-92.jar
  2. 8
      pom.xml
  3. 3
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java
  4. 63
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/WvpSipDate.java
  5. 10
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/RegisterRequestProcessor.java

BIN
libs/jain-sip-ri-1.3.0-92.jar

Binary file not shown.

8
pom.xml

@ -129,10 +129,9 @@
<dependency>
<groupId>javax.sip</groupId>
<artifactId>jain-sip-ri</artifactId>
<version>1.3.0-92</version>
<scope>system</scope>
<systemPath>${pom.basedir}/libs/jain-sip-ri-1.3.0-92.jar</systemPath>
<version>1.3.0-91</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
@ -174,9 +173,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

3
src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java

@ -1,6 +1,8 @@
package com.genersoft.iot.vmp.gb28181.bean;
import gov.nist.javax.sip.header.SIPDate;
import java.util.List;
/**
@ -49,4 +51,5 @@ public class RecordInfo {
public void setRecordList(List<RecordItem> recordList) {
this.recordList = recordList;
}
}

63
src/main/java/com/genersoft/iot/vmp/gb28181/bean/WvpSipDate.java

@ -0,0 +1,63 @@
package com.genersoft.iot.vmp.gb28181.bean;
import gov.nist.javax.sip.header.SIPDate;
/**
* 重写jain sip的SIPDate解决与国标时间格式不一致的问题
*/
public class WvpSipDate extends SIPDate {
public WvpSipDate(long timeMillis) {
super(timeMillis);
}
@Override
public StringBuilder encode(StringBuilder var1) {
String var2;
if (this.month < 9) {
var2 = "0" + (this.month + 1);
} else {
var2 = "" + (this.month + 1);
}
String var3;
if (this.day < 10) {
var3 = "0" + this.day;
} else {
var3 = "" + this.day;
}
String var4;
if (this.hour < 10) {
var4 = "0" + this.hour;
} else {
var4 = "" + this.hour;
}
String var5;
if (this.minute < 10) {
var5 = "0" + this.minute;
} else {
var5 = "" + this.minute;
}
String var6;
if (this.second < 10) {
var6 = "0" + this.second;
} else {
var6 = "" + this.second;
}
int var8 = this.getJavaCal().get(14);
String var7;
if (var8 < 10) {
var7 = "00" + var8;
} else if (var8 < 100) {
var7 = "0" + var8;
} else {
var7 = "" + var8;
}
return var1.append(this.year).append("-").append(var2).append("-").append(var3).append("T").append(var4).append(":").append(var5).append(":").append(var6).append(".").append(var7);
}
}

10
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/RegisterRequestProcessor.java

@ -16,6 +16,8 @@ import javax.sip.header.ViaHeader;
import javax.sip.message.Request;
import javax.sip.message.Response;
import com.genersoft.iot.vmp.gb28181.bean.WvpSipDate;
import gov.nist.javax.sip.header.SIPDateHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
@ -25,7 +27,6 @@ import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
import com.genersoft.iot.vmp.gb28181.auth.RegisterLogicHandler;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.Host;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
@ -88,7 +89,12 @@ public class RegisterRequestProcessor extends SIPRequestAbstractProcessor {
else if (passwordCorrect) {
response = getMessageFactory().createResponse(Response.OK, request);
// 添加date头
response.addHeader(getHeaderFactory().createDateHeader(Calendar.getInstance(Locale.ENGLISH)));
SIPDateHeader dateHeader = new SIPDateHeader();
// 使用自己修改的
WvpSipDate wvpSipDate = new WvpSipDate(Calendar.getInstance(Locale.ENGLISH).getTimeInMillis());
dateHeader.setDate(wvpSipDate);
response.addHeader(dateHeader);
ExpiresHeader expiresHeader = (ExpiresHeader) request.getHeader(Expires.NAME);
// 添加Contact头
response.addHeader(request.getHeader(ContactHeader.NAME));

Loading…
Cancel
Save