优化sip消息,去除自动dialog创建
This commit is contained in:
@@ -380,4 +380,5 @@ public class Device {
|
||||
public void setTreeType(String treeType) {
|
||||
this.treeType = treeType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
|
||||
public class SendRtpItem {
|
||||
|
||||
/**
|
||||
@@ -77,10 +79,20 @@ public class SendRtpItem {
|
||||
private String serverId;
|
||||
|
||||
/**
|
||||
* invite的callId
|
||||
* invite 的 callId
|
||||
*/
|
||||
private String CallId;
|
||||
|
||||
/**
|
||||
* invite 的 fromTag
|
||||
*/
|
||||
private String fromTag;
|
||||
|
||||
/**
|
||||
* invite 的 toTag
|
||||
*/
|
||||
private String toTag;
|
||||
|
||||
/**
|
||||
* 发送时,rtp的pt(uint8_t),不传时默认为96
|
||||
*/
|
||||
@@ -96,15 +108,12 @@ public class SendRtpItem {
|
||||
*/
|
||||
private boolean onlyAudio = false;
|
||||
|
||||
|
||||
/**
|
||||
* 播放类型
|
||||
*/
|
||||
private InviteStreamType playType;
|
||||
|
||||
private byte[] transaction;
|
||||
|
||||
private byte[] dialog;
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
@@ -225,22 +234,6 @@ public class SendRtpItem {
|
||||
this.playType = playType;
|
||||
}
|
||||
|
||||
public byte[] getTransaction() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
public void setTransaction(byte[] transaction) {
|
||||
this.transaction = transaction;
|
||||
}
|
||||
|
||||
public byte[] getDialog() {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public void setDialog(byte[] dialog) {
|
||||
this.dialog = dialog;
|
||||
}
|
||||
|
||||
public int getPt() {
|
||||
return pt;
|
||||
}
|
||||
@@ -272,4 +265,20 @@ public class SendRtpItem {
|
||||
public void setServerId(String serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
public String getFromTag() {
|
||||
return fromTag;
|
||||
}
|
||||
|
||||
public void setFromTag(String fromTag) {
|
||||
this.fromTag = fromTag;
|
||||
}
|
||||
|
||||
public String getToTag() {
|
||||
return toTag;
|
||||
}
|
||||
|
||||
public void setToTag(String toTag) {
|
||||
this.toTag = toTag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeHandlerTask;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -23,15 +24,6 @@ public class SubscribeHolder {
|
||||
@Autowired
|
||||
private DynamicTask dynamicTask;
|
||||
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
@Autowired
|
||||
private ISIPCommanderForPlatform sipCommanderForPlatform;
|
||||
|
||||
@Autowired
|
||||
private IVideoManagerStorage storager;
|
||||
|
||||
private final String taskOverduePrefix = "subscribe_overdue_";
|
||||
|
||||
private static ConcurrentHashMap<String, SubscribeInfo> catalogMap = new ConcurrentHashMap<>();
|
||||
@@ -62,15 +54,13 @@ public class SubscribeHolder {
|
||||
}
|
||||
// 添加任务处理订阅过期
|
||||
dynamicTask.stop(taskOverdueKey);
|
||||
|
||||
}
|
||||
|
||||
public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo) {
|
||||
mobilePositionMap.put(platformId, subscribeInfo);
|
||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + "MobilePosition_" + platformId;
|
||||
// 添加任务处理GPS定时推送
|
||||
dynamicTask.startCron(key, new MobilePositionSubscribeHandlerTask(redisCatchStorage, sipCommanderForPlatform,
|
||||
storager, platformId, subscribeInfo.getSn(), key, this, dynamicTask),
|
||||
dynamicTask.startCron(key, new MobilePositionSubscribeHandlerTask(platformId),
|
||||
subscribeInfo.getGpsInterval() * 1000);
|
||||
String taskOverdueKey = taskOverduePrefix + "MobilePosition_" + platformId;
|
||||
// 添加任务处理订阅过期
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.utils.SerializeUtils;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import gov.nist.javax.sip.message.SIPResponse;
|
||||
|
||||
import javax.sip.ClientTransaction;
|
||||
import javax.sip.Dialog;
|
||||
import javax.sip.RequestEvent;
|
||||
import javax.sip.ServerTransaction;
|
||||
@@ -11,30 +14,24 @@ import javax.sip.message.Request;
|
||||
public class SubscribeInfo {
|
||||
|
||||
|
||||
public SubscribeInfo(RequestEvent evt, String id) {
|
||||
public SubscribeInfo(ServerTransaction serverTransaction, String id) {
|
||||
this.id = id;
|
||||
Request request = evt.getRequest();
|
||||
ExpiresHeader expiresHeader = (ExpiresHeader)request.getHeader(ExpiresHeader.NAME);
|
||||
this.expires = expiresHeader.getExpires();
|
||||
SIPRequest request = (SIPRequest)serverTransaction.getRequest();
|
||||
this.request = request;
|
||||
this.expires = request.getExpires().getExpires();
|
||||
EventHeader eventHeader = (EventHeader)request.getHeader(EventHeader.NAME);
|
||||
this.eventId = eventHeader.getEventId();
|
||||
this.eventType = eventHeader.getEventType();
|
||||
this.transaction = evt.getServerTransaction();
|
||||
this.dialog = evt.getDialog();
|
||||
CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME);
|
||||
this.callId = callIdHeader.getCallId();
|
||||
}
|
||||
|
||||
public SubscribeInfo() {
|
||||
}
|
||||
|
||||
private String id;
|
||||
|
||||
private SIPRequest request;
|
||||
private int expires;
|
||||
private String callId;
|
||||
private String eventId;
|
||||
private String eventType;
|
||||
private ServerTransaction transaction;
|
||||
private Dialog dialog;
|
||||
private SIPResponse response;
|
||||
|
||||
/**
|
||||
* 以下为可选字段
|
||||
@@ -43,29 +40,28 @@ public class SubscribeInfo {
|
||||
private String sn;
|
||||
private int gpsInterval;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getExpires() {
|
||||
return expires;
|
||||
}
|
||||
|
||||
public String getCallId() {
|
||||
return callId;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setExpires(int expires) {
|
||||
this.expires = expires;
|
||||
public SIPRequest getRequest() {
|
||||
return request;
|
||||
}
|
||||
|
||||
public void setCallId(String callId) {
|
||||
this.callId = callId;
|
||||
public void setRequest(SIPRequest request) {
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public int getExpires() {
|
||||
return expires;
|
||||
}
|
||||
|
||||
public void setExpires(int expires) {
|
||||
this.expires = expires;
|
||||
}
|
||||
|
||||
public String getEventId() {
|
||||
@@ -84,20 +80,12 @@ public class SubscribeInfo {
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
public ServerTransaction getTransaction() {
|
||||
return transaction;
|
||||
public SIPResponse getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void setTransaction(ServerTransaction transaction) {
|
||||
this.transaction = transaction;
|
||||
}
|
||||
|
||||
public Dialog getDialog() {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public void setDialog(Dialog dialog) {
|
||||
this.dialog = dialog;
|
||||
public void setResponse(SIPResponse response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
|
||||
Reference in New Issue
Block a user