From 712b25fb6eea8e85fd2c43d2956529312afdd3dc Mon Sep 17 00:00:00 2001
From: lawrencehj <1934378145@qq.com>
Date: 星期日, 14 三月 2021 21:25:52 +0800
Subject: [PATCH] 增加上级远程启动TeleBoot功能的支持
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java | 46 ++++++++++++++--------------------------------
1 files changed, 14 insertions(+), 32 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
index ac19d6f..dc41fe7 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
@@ -7,14 +7,10 @@
import javax.sip.SipFactory;
import javax.sip.address.Address;
import javax.sip.address.SipURI;
-import javax.sip.header.ContentTypeHeader;
-import javax.sip.header.FromHeader;
-import javax.sip.header.HeaderFactory;
-import javax.sip.header.SubjectHeader;
+import javax.sip.header.*;
import javax.sip.message.Request;
import javax.sip.message.Response;
-import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.conf.MediaServerConfig;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
@@ -27,17 +23,12 @@
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
-import gov.nist.javax.sdp.fields.SDPFormat;
import gov.nist.javax.sip.address.AddressImpl;
import gov.nist.javax.sip.address.SipUri;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import java.io.IOException;
import java.text.ParseException;
-import java.util.List;
-import java.util.UUID;
import java.util.Vector;
/**
@@ -45,6 +36,7 @@
* @author: panll
* @date: 2021骞�1鏈�14鏃�
*/
+@SuppressWarnings("rawtypes")
public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
private final static Logger logger = LoggerFactory.getLogger(MessageRequestProcessor.class);
@@ -83,20 +75,6 @@
SipURI sipURI = (SipURI) request.getRequestURI();
String channelId = sipURI.getUser();
String platformId = null;
-// SubjectHeader subjectHeader = (SubjectHeader)request.getHeader(SubjectHeader.NAME);
-// // 鏌ヨ閫氶亾鏄惁瀛樺湪 涓嶅瓨鍦ㄥ洖澶�404
-// if (subjectHeader != null) { // 瀛樺湪鍒欎粠subjectHeader 鑾峰彇骞冲彴淇℃伅
-// String subject = subjectHeader.getSubject();
-// if (subject != null) {
-// String[] info1 = subject.split(",");
-// if (info1 != null && info1 .length == 2) {
-// String[] info2 = info1[1].split(":");
-// if (info2 != null && info2.length == 2) {
-// platformId = info2[0];
-// }
-// }
-// }
-// }
FromHeader fromHeader = (FromHeader)request.getHeader(FromHeader.NAME);
AddressImpl address = (AddressImpl) fromHeader.getAddress();
@@ -122,8 +100,10 @@
// jainSip涓嶆敮鎸亂=瀛楁锛� 绉婚櫎绉婚櫎浠ヨВ鏋愩��
int ssrcIndex = contentString.indexOf("y=");
- String ssrc = contentString.substring(ssrcIndex + 2, contentString.length())
- .replace("\r\n", "").replace("\n", "");
+ String ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12);
+ //ssrc瑙勫畾闀垮害涓�10瀛楄妭锛屼笉鍙栦綑涓嬮暱搴︿互閬垮厤鍚庣画杩樻湁鈥渇=鈥濆瓧娈�
+ // String ssrc = contentString.substring(ssrcIndex + 2, contentString.length())
+ // .replace("\r\n", "").replace("\n", "");
String substring = contentString.substring(0, contentString.indexOf("y="));
SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring);
@@ -131,9 +111,9 @@
// 鑾峰彇鏀寔鐨勬牸寮�
Vector mediaDescriptions = sdp.getMediaDescriptions(true);
// 鏌ョ湅鏄惁鏀寔PS 璐熻浇96
- String ip = null;
+ //String ip = null;
int port = -1;
- boolean recvonly = false;
+ //boolean recvonly = false;
boolean mediaTransmissionTCP = false;
Boolean tcpActive = null;
for (int i = 0; i < mediaDescriptions.size(); i++) {
@@ -143,7 +123,7 @@
Vector mediaFormats = media.getMediaFormats(false);
if (mediaFormats.contains("96")) {
port = media.getMediaPort();
- String mediaType = media.getMediaType();
+ //String mediaType = media.getMediaType();
String protocol = media.getProtocol();
// 鍖哄垎TCP鍙戞祦杩樻槸udp锛� 褰撳墠榛樿udp
@@ -169,7 +149,7 @@
}
String username = sdp.getOrigin().getUsername();
String addressStr = sdp.getOrigin().getAddress();
- String sessionName = sdp.getSessionName().getValue();
+ //String sessionName = sdp.getSessionName().getValue();
logger.info("[涓婄骇鐐规挱]鐢ㄦ埛锛歿}锛� 鍦板潃锛歿}:{}锛� ssrc锛歿}", username, addressStr, port, ssrc);
Device device = storager.queryVideoDeviceByPlatformIdAndChannelId(platformId, channelId);
@@ -178,7 +158,7 @@
responseAck(evt, Response.SERVER_INTERNAL_ERROR);
return;
}
- SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(ip, port, platformId, ssrc, channelId,
+ SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(addressStr, port, ssrc, platformId, device.getDeviceId(), channelId,
mediaTransmissionTCP);
if (tcpActive != null) {
sendRtpItem.setTcpActive(tcpActive);
@@ -230,7 +210,9 @@
e.printStackTrace();
}
}));
- playResult.getResult();
+ if (logger.isDebugEnabled()) {
+ logger.debug(playResult.getResult().toString());
+ }
} catch (SipException | InvalidArgumentException | ParseException e) {
e.printStackTrace();
--
Gitblit v1.8.0