From eb6b6529cd5a59cd684b7ad1a3d569487fa4daa0 Mon Sep 17 00:00:00 2001
From: 64850858 <648540858@qq.com>
Date: 星期一, 07 六月 2021 15:51:58 +0800
Subject: [PATCH] 修复DeviceChannelMapper的存储错误
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java | 68 ++++++++++++++++++----------------
1 files changed, 36 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 43be89d..7602c06 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
@@ -11,7 +11,7 @@
import javax.sip.message.Request;
import javax.sip.message.Response;
-import com.genersoft.iot.vmp.conf.MediaServerConfig;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
@@ -92,10 +92,18 @@
DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId);
GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId);
// 涓嶆槸閫氶亾鍙兘鏄洿鎾祦
- if (channel != null || gbStream != null ) {
+ if (channel != null && gbStream == null ) {
if (channel.getStatus() == 0) {
logger.info("閫氶亾绂荤嚎锛岃繑鍥�400");
responseAck(evt, Response.BAD_REQUEST, "channel [" + channel.getChannelId() + "] offline");
+ return;
+ }
+ responseAck(evt, Response.CALL_IS_BEING_FORWARDED); // 閫氶亾瀛樺湪锛屽彂181锛屽懠鍙浆鎺ヤ腑
+ }else if(channel == null && gbStream != null){
+ Boolean streamReady = zlmrtpServerFactory.isStreamReady(gbStream.getApp(), gbStream.getStream());
+ if (!streamReady) {
+ logger.info("[ app={}, stream={} ]閫氶亾绂荤嚎锛岃繑鍥�400",gbStream.getApp(), gbStream.getStream());
+ responseAck(evt, Response.BAD_REQUEST, "channel [" + gbStream.getGbId() + "] offline");
return;
}
responseAck(evt, Response.CALL_IS_BEING_FORWARDED); // 閫氶亾瀛樺湪锛屽彂181锛屽懠鍙浆鎺ヤ腑
@@ -187,12 +195,12 @@
sendRtpItem.setStatus(1);
redisCatchStorage.updateSendRTPSever(sendRtpItem);
// TODO 娣诲姞瀵箃cp鐨勬敮鎸�
- MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
+ ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n");
- content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n");
+ content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("s=Play\r\n");
- content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n");
+ content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("t=0 0\r\n");
content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n");
content.append("a=sendonly\r\n");
@@ -240,34 +248,30 @@
// 鍐欏叆redis锛� 瓒呮椂鏃跺洖澶�
redisCatchStorage.updateSendRTPSever(sendRtpItem);
- // 妫�娴嬬洿鎾祦鏄惁鍦ㄧ嚎
- Boolean streamReady = zlmrtpServerFactory.isStreamReady(gbStream.getApp(), gbStream.getStream());
- if (streamReady) {
- sendRtpItem.setStatus(1);
- redisCatchStorage.updateSendRTPSever(sendRtpItem);
- // TODO 娣诲姞瀵箃cp鐨勬敮鎸�
- MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
- StringBuffer content = new StringBuffer(200);
- content.append("v=0\r\n");
- content.append("o="+"00000"+" 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");
- content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n");
- content.append("a=sendonly\r\n");
- content.append("a=rtpmap:96 PS/90000\r\n");
- content.append("y="+ ssrc + "\r\n");
- content.append("f=\r\n");
+ sendRtpItem.setStatus(1);
+ redisCatchStorage.updateSendRTPSever(sendRtpItem);
+ // TODO 娣诲姞瀵箃cp鐨勬敮鎸�
+ ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
+ StringBuffer content = new StringBuffer(200);
+ content.append("v=0\r\n");
+ content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
+ content.append("s=Play\r\n");
+ content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
+ content.append("t=0 0\r\n");
+ content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n");
+ content.append("a=sendonly\r\n");
+ content.append("a=rtpmap:96 PS/90000\r\n");
+ content.append("y="+ ssrc + "\r\n");
+ content.append("f=\r\n");
- try {
- responseAck(evt, content.toString());
- } catch (SipException e) {
- e.printStackTrace();
- } catch (InvalidArgumentException e) {
- e.printStackTrace();
- } catch (ParseException e) {
- e.printStackTrace();
- }
+ try {
+ responseAck(evt, content.toString());
+ } catch (SipException e) {
+ e.printStackTrace();
+ } catch (InvalidArgumentException e) {
+ e.printStackTrace();
+ } catch (ParseException e) {
+ e.printStackTrace();
}
}
--
Gitblit v1.8.0