与master分支同步
This commit is contained in:
@@ -113,6 +113,7 @@ public class SipLayer implements SipListener {
|
||||
*/
|
||||
@Override
|
||||
public void processRequest(RequestEvent evt) {
|
||||
logger.debug(evt.getRequest().toString());
|
||||
// 由于jainsip是单线程程序,为提高性能并发处理
|
||||
processThreadPool.execute(() -> {
|
||||
processorFactory.createRequestProcessor(evt).process();
|
||||
@@ -122,6 +123,7 @@ public class SipLayer implements SipListener {
|
||||
@Override
|
||||
public void processResponse(ResponseEvent evt) {
|
||||
Response response = evt.getResponse();
|
||||
logger.debug(evt.getResponse().toString());
|
||||
int status = response.getStatusCode();
|
||||
if (((status >= 200) && (status < 300)) || status == 401) { // Success!
|
||||
ISIPResponseProcessor processor = processorFactory.createResponseProcessor(evt);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> {
|
||||
public void onApplicationEvent(OnlineEvent event) {
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("设备离线事件触发,deviceId:" + event.getDeviceId() + ",from:" + event.getFrom());
|
||||
logger.debug("设备上线事件触发,deviceId:" + event.getDeviceId() + ",from:" + event.getFrom());
|
||||
}
|
||||
|
||||
String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + event.getDeviceId();
|
||||
|
||||
@@ -17,13 +17,11 @@ public class VideoStreamSessionManager {
|
||||
private ConcurrentHashMap<String, ClientTransaction> sessionMap = new ConcurrentHashMap<>();
|
||||
|
||||
public String createPlaySsrc(){
|
||||
String ssrc = SsrcUtil.getPlaySsrc();
|
||||
return ssrc;
|
||||
return SsrcUtil.getPlaySsrc();
|
||||
}
|
||||
|
||||
public String createPlayBackSsrc(){
|
||||
String ssrc = SsrcUtil.getPlayBackSsrc();
|
||||
return ssrc;
|
||||
return SsrcUtil.getPlayBackSsrc();
|
||||
}
|
||||
|
||||
public void put(String ssrc,ClientTransaction transaction){
|
||||
|
||||
@@ -22,6 +22,8 @@ public class DeferredResultHolder {
|
||||
|
||||
public static final String CALLBACK_CMD_RECORDINFO = "CALLBACK_RECORDINFO";
|
||||
|
||||
public static final String CALLBACK_CMD_PlAY = "CALLBACK_PLAY";
|
||||
|
||||
private Map<String, DeferredResult> map = new HashMap<String, DeferredResult>();
|
||||
|
||||
public void put(String key, DeferredResult result) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
|
||||
/**
|
||||
@@ -20,7 +21,7 @@ public interface ISIPCommander {
|
||||
* @param upDown 镜头上移下移 0:停止 1:上移 2:下移
|
||||
* @param moveSpeed 镜头移动速度
|
||||
*/
|
||||
public boolean ptzdirectCmd(Device device,String channelId,int leftRight, int upDown);
|
||||
boolean ptzdirectCmd(Device device,String channelId,int leftRight, int upDown);
|
||||
|
||||
/**
|
||||
* 云台方向放控制
|
||||
@@ -31,7 +32,7 @@ public interface ISIPCommander {
|
||||
* @param upDown 镜头上移下移 0:停止 1:上移 2:下移
|
||||
* @param moveSpeed 镜头移动速度
|
||||
*/
|
||||
public boolean ptzdirectCmd(Device device,String channelId,int leftRight, int upDown, int moveSpeed);
|
||||
boolean ptzdirectCmd(Device device,String channelId,int leftRight, int upDown, int moveSpeed);
|
||||
|
||||
/**
|
||||
* 云台缩放控制,使用配置文件中的默认镜头缩放速度
|
||||
@@ -40,7 +41,7 @@ public interface ISIPCommander {
|
||||
* @param channelId 预览通道
|
||||
* @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大
|
||||
*/
|
||||
public boolean ptzZoomCmd(Device device,String channelId,int inOut);
|
||||
boolean ptzZoomCmd(Device device,String channelId,int inOut);
|
||||
|
||||
/**
|
||||
* 云台缩放控制
|
||||
@@ -50,7 +51,7 @@ public interface ISIPCommander {
|
||||
* @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大
|
||||
* @param zoomSpeed 镜头缩放速度
|
||||
*/
|
||||
public boolean ptzZoomCmd(Device device,String channelId,int inOut, int moveSpeed);
|
||||
boolean ptzZoomCmd(Device device,String channelId,int inOut, int moveSpeed);
|
||||
|
||||
/**
|
||||
* 云台控制,支持方向与缩放控制
|
||||
@@ -63,7 +64,7 @@ public interface ISIPCommander {
|
||||
* @param moveSpeed 镜头移动速度
|
||||
* @param zoomSpeed 镜头缩放速度
|
||||
*/
|
||||
public boolean ptzCmd(Device device,String channelId,int leftRight, int upDown, int inOut, int moveSpeed, int zoomSpeed);
|
||||
boolean ptzCmd(Device device,String channelId,int leftRight, int upDown, int inOut, int moveSpeed, int zoomSpeed);
|
||||
|
||||
/**
|
||||
* 前端控制,包括PTZ指令、FI指令、预置位指令、巡航指令、扫描指令和辅助开关指令
|
||||
@@ -75,7 +76,7 @@ public interface ISIPCommander {
|
||||
* @param parameter2 数据2
|
||||
* @param combineCode2 组合码2
|
||||
*/
|
||||
public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2);
|
||||
boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2);
|
||||
|
||||
/**
|
||||
* 请求预览视频流
|
||||
@@ -83,7 +84,7 @@ public interface ISIPCommander {
|
||||
* @param device 视频设备
|
||||
* @param channelId 预览通道
|
||||
*/
|
||||
public StreamInfo playStreamCmd(Device device, String channelId);
|
||||
void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event);
|
||||
|
||||
/**
|
||||
* 请求回放视频流
|
||||
@@ -93,14 +94,14 @@ public interface ISIPCommander {
|
||||
* @param startTime 开始时间,格式要求:yyyy-MM-dd HH:mm:ss
|
||||
* @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
public StreamInfo playbackStreamCmd(Device device,String channelId, String startTime, String endTime);
|
||||
void playbackStreamCmd(Device device, String channelId, String startTime, String endTime, ZLMHttpHookSubscribe.Event event);
|
||||
|
||||
/**
|
||||
* 视频流停止
|
||||
*
|
||||
* @param ssrc ssrc
|
||||
*/
|
||||
public void streamByeCmd(String ssrc);
|
||||
void streamByeCmd(String ssrc);
|
||||
|
||||
/**
|
||||
* 语音广播
|
||||
@@ -108,7 +109,7 @@ public interface ISIPCommander {
|
||||
* @param device 视频设备
|
||||
* @param channelId 预览通道
|
||||
*/
|
||||
public boolean audioBroadcastCmd(Device device,String channelId);
|
||||
boolean audioBroadcastCmd(Device device,String channelId);
|
||||
|
||||
/**
|
||||
* 音视频录像控制
|
||||
@@ -116,21 +117,21 @@ public interface ISIPCommander {
|
||||
* @param device 视频设备
|
||||
* @param channelId 预览通道
|
||||
*/
|
||||
public boolean recordCmd(Device device,String channelId);
|
||||
boolean recordCmd(Device device,String channelId);
|
||||
|
||||
/**
|
||||
* 报警布防/撤防命令
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean guardCmd(Device device);
|
||||
boolean guardCmd(Device device);
|
||||
|
||||
/**
|
||||
* 报警复位命令
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean alarmCmd(Device device);
|
||||
boolean alarmCmd(Device device);
|
||||
|
||||
/**
|
||||
* 强制关键帧命令,设备收到此命令应立刻发送一个IDR帧
|
||||
@@ -138,21 +139,21 @@ public interface ISIPCommander {
|
||||
* @param device 视频设备
|
||||
* @param channelId 预览通道
|
||||
*/
|
||||
public boolean iFameCmd(Device device,String channelId);
|
||||
boolean iFameCmd(Device device,String channelId);
|
||||
|
||||
/**
|
||||
* 看守位控制命令
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean homePositionCmd(Device device);
|
||||
boolean homePositionCmd(Device device);
|
||||
|
||||
/**
|
||||
* 设备配置命令
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean deviceConfigCmd(Device device);
|
||||
boolean deviceConfigCmd(Device device);
|
||||
|
||||
|
||||
/**
|
||||
@@ -160,7 +161,7 @@ public interface ISIPCommander {
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean deviceStatusQuery(Device device);
|
||||
boolean deviceStatusQuery(Device device);
|
||||
|
||||
/**
|
||||
* 查询设备信息
|
||||
@@ -168,14 +169,14 @@ public interface ISIPCommander {
|
||||
* @param device 视频设备
|
||||
* @return
|
||||
*/
|
||||
public boolean deviceInfoQuery(Device device);
|
||||
boolean deviceInfoQuery(Device device);
|
||||
|
||||
/**
|
||||
* 查询目录列表
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean catalogQuery(Device device);
|
||||
boolean catalogQuery(Device device);
|
||||
|
||||
/**
|
||||
* 查询录像信息
|
||||
@@ -184,35 +185,33 @@ public interface ISIPCommander {
|
||||
* @param startTime 开始时间,格式要求:yyyy-MM-dd HH:mm:ss
|
||||
* @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
public boolean recordInfoQuery(Device device, String channelId, String startTime, String endTime);
|
||||
boolean recordInfoQuery(Device device, String channelId, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 查询报警信息
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean alarmInfoQuery(Device device);
|
||||
boolean alarmInfoQuery(Device device);
|
||||
|
||||
/**
|
||||
* 查询设备配置
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean configQuery(Device device);
|
||||
boolean configQuery(Device device);
|
||||
|
||||
/**
|
||||
* 查询设备预置位置
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean presetQuery(Device device);
|
||||
boolean presetQuery(Device device);
|
||||
|
||||
/**
|
||||
* 查询移动设备位置数据
|
||||
*
|
||||
* @param device 视频设备
|
||||
*/
|
||||
public boolean mobilePostitionQuery(Device device);
|
||||
|
||||
|
||||
boolean mobilePostitionQuery(Device device);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMUtils;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -67,6 +68,9 @@ public class SIPCommander implements ISIPCommander {
|
||||
@Value("${media.rtp.enable}")
|
||||
private boolean rtpEnable;
|
||||
|
||||
@Autowired
|
||||
private ZLMHttpHookSubscribe subscribe;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -264,12 +268,12 @@ public class SIPCommander implements ISIPCommander {
|
||||
}
|
||||
/**
|
||||
* 请求预览视频流
|
||||
*
|
||||
*
|
||||
* @param device 视频设备
|
||||
* @param channelId 预览通道
|
||||
*/
|
||||
*/
|
||||
@Override
|
||||
public StreamInfo playStreamCmd(Device device, String channelId) {
|
||||
public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event) {
|
||||
try {
|
||||
|
||||
String ssrc = streamSession.createPlaySsrc();
|
||||
@@ -282,53 +286,63 @@ public class SIPCommander implements ISIPCommander {
|
||||
}else {
|
||||
mediaPort = mediaInfo.getRtpProxyPort();
|
||||
}
|
||||
|
||||
String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
|
||||
// 添加订阅
|
||||
JSONObject subscribeKey = new JSONObject();
|
||||
subscribeKey.put("app", "rtp");
|
||||
subscribeKey.put("id", streamId);
|
||||
|
||||
subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, subscribeKey, event);
|
||||
//
|
||||
StringBuffer content = new StringBuffer(200);
|
||||
content.append("v=0\r\n");
|
||||
content.append("o="+channelId+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n");
|
||||
content.append("s=Play\r\n");
|
||||
content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n");
|
||||
content.append("t=0 0\r\n");
|
||||
if("TCP-PASSIVE".equals(streamMode)) {
|
||||
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n");
|
||||
content.append("v=0\r\n");
|
||||
content.append("o="+channelId+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n");
|
||||
content.append("s=Play\r\n");
|
||||
content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n");
|
||||
content.append("t=0 0\r\n");
|
||||
if("TCP-PASSIVE".equals(streamMode)) {
|
||||
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
|
||||
}else if ("TCP-ACTIVE".equals(streamMode)) {
|
||||
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n");
|
||||
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
|
||||
}else if("UDP".equals(streamMode)) {
|
||||
content.append("m=video "+ mediaPort +" RTP/AVP 96 98 97\r\n");
|
||||
content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n");
|
||||
}
|
||||
content.append("a=recvonly\r\n");
|
||||
content.append("a=rtpmap:96 PS/90000\r\n");
|
||||
content.append("a=rtpmap:98 H264/90000\r\n");
|
||||
content.append("a=rtpmap:97 MPEG4/90000\r\n");
|
||||
if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式
|
||||
content.append("a=setup:passive\r\n");
|
||||
content.append("a=recvonly\r\n");
|
||||
content.append("a=fmtp:126 profile-level-id=42e01e\r\n");
|
||||
content.append("a=rtpmap:126 H264/90000\r\n");
|
||||
content.append("a=rtpmap:125 H264S/90000\r\n");
|
||||
content.append("a=fmtp:125 profile-level-id=42e01e\r\n");
|
||||
content.append("a=rtpmap:99 MP4V-ES/90000\r\n");
|
||||
content.append("a=fmtp:99 profile-level-id=3\r\n");
|
||||
content.append("a=rtpmap:98 H264/90000\r\n");
|
||||
content.append("a=rtpmap:97 MPEG4/90000\r\n");
|
||||
content.append("a=rtpmap:96 PS/90000\r\n");
|
||||
if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式
|
||||
content.append("a=setup:passive\r\n");
|
||||
content.append("a=connection:new\r\n");
|
||||
}else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式
|
||||
}else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式
|
||||
content.append("a=setup:active\r\n");
|
||||
content.append("a=connection:new\r\n");
|
||||
}
|
||||
content.append("y="+ssrc+"\r\n");//ssrc
|
||||
|
||||
Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "live", null, ssrc);
|
||||
|
||||
ClientTransaction transaction = transmitRequest(device, request);
|
||||
streamSession.put(ssrc, transaction);
|
||||
content.append("y="+ssrc+"\r\n");//ssrc
|
||||
|
||||
Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "live", null, ssrc);
|
||||
|
||||
ClientTransaction transaction = transmitRequest(device, request);
|
||||
streamSession.put(ssrc, transaction);
|
||||
DeviceChannel deviceChannel = storager.queryChannel(device.getDeviceId(), channelId);
|
||||
if (deviceChannel != null) {
|
||||
deviceChannel.setSsrc(ssrc);
|
||||
storager.updateChannel(device.getDeviceId(), deviceChannel);
|
||||
}
|
||||
|
||||
StreamInfo streamInfo = new StreamInfo();
|
||||
streamInfo.setSsrc(ssrc);
|
||||
streamInfo.setCahnnelId(channelId);
|
||||
streamInfo.setDeviceID(device.getDeviceId());
|
||||
storager.startPlay(streamInfo);
|
||||
return streamInfo;
|
||||
// TODO 订阅SIP response,处理对方的错误返回
|
||||
|
||||
|
||||
} catch ( SipException | ParseException | InvalidArgumentException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,10 +354,18 @@ public class SIPCommander implements ISIPCommander {
|
||||
* @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@Override
|
||||
public StreamInfo playbackStreamCmd(Device device, String channelId, String startTime, String endTime) {
|
||||
public void playbackStreamCmd(Device device, String channelId, String startTime, String endTime, ZLMHttpHookSubscribe.Event event) {
|
||||
try {
|
||||
MediaServerConfig mediaInfo = storager.getMediaInfo();
|
||||
String ssrc = streamSession.createPlayBackSsrc();
|
||||
String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
|
||||
// 添加订阅
|
||||
JSONObject subscribeKey = new JSONObject();
|
||||
subscribeKey.put("app", "rtp");
|
||||
subscribeKey.put("id", streamId);
|
||||
|
||||
subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, subscribeKey, event);
|
||||
|
||||
//
|
||||
StringBuffer content = new StringBuffer(200);
|
||||
content.append("v=0\r\n");
|
||||
@@ -362,16 +384,22 @@ public class SIPCommander implements ISIPCommander {
|
||||
}
|
||||
String streamMode = device.getStreamMode().toUpperCase();
|
||||
if("TCP-PASSIVE".equals(streamMode)) {
|
||||
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n");
|
||||
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
|
||||
}else if ("TCP-ACTIVE".equals(streamMode)) {
|
||||
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n");
|
||||
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
|
||||
}else if("UDP".equals(streamMode)) {
|
||||
content.append("m=video "+ mediaPort +" RTP/AVP 96 98 97\r\n");
|
||||
content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n");
|
||||
}
|
||||
content.append("a=recvonly\r\n");
|
||||
content.append("a=rtpmap:96 PS/90000\r\n");
|
||||
content.append("a=rtpmap:98 H264/90000\r\n");
|
||||
content.append("a=rtpmap:97 MPEG4/90000\r\n");
|
||||
content.append("a=recvonly\r\n");
|
||||
content.append("a=fmtp:126 profile-level-id=42e01e\r\n");
|
||||
content.append("a=rtpmap:126 H264/90000\r\n");
|
||||
content.append("a=rtpmap:125 H264S/90000\r\n");
|
||||
content.append("a=fmtp:125 profile-level-id=42e01e\r\n");
|
||||
content.append("a=rtpmap:99 MP4V-ES/90000\r\n");
|
||||
content.append("a=fmtp:99 profile-level-id=3\r\n");
|
||||
content.append("a=rtpmap:98 H264/90000\r\n");
|
||||
content.append("a=rtpmap:97 MPEG4/90000\r\n");
|
||||
content.append("a=rtpmap:96 PS/90000\r\n");
|
||||
if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式
|
||||
content.append("a=setup:passive\r\n");
|
||||
content.append("a=connection:new\r\n");
|
||||
@@ -386,16 +414,8 @@ public class SIPCommander implements ISIPCommander {
|
||||
ClientTransaction transaction = transmitRequest(device, request);
|
||||
streamSession.put(ssrc, transaction);
|
||||
|
||||
StreamInfo streamInfo = new StreamInfo();
|
||||
streamInfo.setSsrc(ssrc);
|
||||
streamInfo.setCahnnelId(channelId);
|
||||
streamInfo.setDeviceID(device.getDeviceId());
|
||||
boolean b = storager.startPlayback(streamInfo);
|
||||
return streamInfo;
|
||||
|
||||
} catch ( SipException | ParseException | InvalidArgumentException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,6 +453,7 @@ public class SIPCommander implements ISIPCommander {
|
||||
clientTransaction = udpSipProvider.getNewClientTransaction(byeRequest);
|
||||
}
|
||||
dialog.sendRequest(clientTransaction);
|
||||
streamSession.remove(ssrc);
|
||||
} catch (TransactionDoesNotExistException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SipException e) {
|
||||
|
||||
@@ -21,14 +21,12 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
||||
* 处理 ACK请求
|
||||
*
|
||||
* @param evt
|
||||
* @param layer
|
||||
* @param transaction
|
||||
* @param config
|
||||
*/
|
||||
*/
|
||||
@Override
|
||||
public void process(RequestEvent evt) {
|
||||
Request request = evt.getRequest();
|
||||
Dialog dialog = evt.getDialog();
|
||||
if (dialog == null) return;
|
||||
try {
|
||||
Request ackRequest = null;
|
||||
CSeq csReq = (CSeq) request.getHeader(CSeq.NAME);
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.genersoft.iot.vmp.gb28181.transmit.request.impl;
|
||||
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.RequestEvent;
|
||||
import javax.sip.SipException;
|
||||
import javax.sip.message.Response;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* @Description: BYE请求处理器
|
||||
* @author: swwheihei
|
||||
@@ -11,18 +16,35 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso
|
||||
*/
|
||||
public class ByeRequestProcessor extends SIPRequestAbstractProcessor {
|
||||
|
||||
/**
|
||||
/**
|
||||
* 处理BYE请求
|
||||
*
|
||||
* @param evt
|
||||
* @param layer
|
||||
* @param transaction
|
||||
* @param config
|
||||
*/
|
||||
*/
|
||||
@Override
|
||||
public void process(RequestEvent evt) {
|
||||
try {
|
||||
responseAck(evt);
|
||||
} catch (SipException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// TODO 优先级99 Bye Request消息实现,此消息一般为级联消息,上级给下级发送视频停止指令
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
* 回复200 OK
|
||||
* @param evt
|
||||
* @throws SipException
|
||||
* @throws InvalidArgumentException
|
||||
* @throws ParseException
|
||||
*/
|
||||
private void responseAck(RequestEvent evt) throws SipException, InvalidArgumentException, ParseException {
|
||||
Response response = getMessageFactory().createResponse(Response.OK, evt.getRequest());
|
||||
getServerTransaction(evt).sendResponse(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -184,10 +184,11 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
|
||||
DeviceChannel deviceChannel = new DeviceChannel();
|
||||
deviceChannel.setName(channelName);
|
||||
deviceChannel.setChannelId(channelDeviceId);
|
||||
if (status.equals("ON") || status.equals("On")) {
|
||||
// ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理
|
||||
if (status.equals("ON") || status.equals("On") || status.equals("ONLINE")) {
|
||||
deviceChannel.setStatus(1);
|
||||
}
|
||||
if (status.equals("OFF") || status.equals("Off")) {
|
||||
if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) {
|
||||
deviceChannel.setStatus(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user