Commit 16cb8cd1951e6bc00b53975ff56968fecc988958
Merge remote-tracking branch 'origin/wvp-28181-2.0' into commercial
# Conflicts: # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
Showing
3 changed files
with
30 additions
and
23 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
| @@ -4,8 +4,12 @@ import com.alibaba.fastjson.JSON; | @@ -4,8 +4,12 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.genersoft.iot.vmp.common.StreamInfo; | 5 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 6 | import com.genersoft.iot.vmp.conf.DynamicTask; | 6 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 7 | +import com.genersoft.iot.vmp.gb28181.bean.InviteStreamType; | ||
| 8 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; | 9 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 11 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | ||
| 12 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | ||
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; | 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 14 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 11 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | 15 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| @@ -13,6 +17,8 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | @@ -13,6 +17,8 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | ||
| 13 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 17 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 14 | import com.genersoft.iot.vmp.service.IMediaServerService; | 18 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 15 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 19 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 20 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 21 | +import org.ehcache.shadow.org.terracotta.offheapstore.storage.IntegerStorageEngine; | ||
| 16 | import org.slf4j.Logger; | 22 | import org.slf4j.Logger; |
| 17 | import org.slf4j.LoggerFactory; | 23 | import org.slf4j.LoggerFactory; |
| 18 | import org.springframework.beans.factory.InitializingBean; | 24 | import org.springframework.beans.factory.InitializingBean; |
| @@ -51,6 +57,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -51,6 +57,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 51 | private IRedisCatchStorage redisCatchStorage; | 57 | private IRedisCatchStorage redisCatchStorage; |
| 52 | 58 | ||
| 53 | @Autowired | 59 | @Autowired |
| 60 | + private IVideoManagerStorage storager; | ||
| 61 | + | ||
| 62 | + @Autowired | ||
| 54 | private ZLMRTPServerFactory zlmrtpServerFactory; | 63 | private ZLMRTPServerFactory zlmrtpServerFactory; |
| 55 | 64 | ||
| 56 | @Autowired | 65 | @Autowired |
| @@ -62,6 +71,12 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -62,6 +71,12 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 62 | @Autowired | 71 | @Autowired |
| 63 | private DynamicTask dynamicTask; | 72 | private DynamicTask dynamicTask; |
| 64 | 73 | ||
| 74 | + @Autowired | ||
| 75 | + private ISIPCommander cmder; | ||
| 76 | + | ||
| 77 | + @Autowired | ||
| 78 | + private ISIPCommanderForPlatform commanderForPlatform; | ||
| 79 | + | ||
| 65 | 80 | ||
| 66 | /** | 81 | /** |
| 67 | * 处理 ACK请求 | 82 | * 处理 ACK请求 |
| @@ -78,6 +93,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -78,6 +93,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 78 | if (dialog.getState()== DialogState.CONFIRMED) { | 93 | if (dialog.getState()== DialogState.CONFIRMED) { |
| 79 | String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser(); | 94 | String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser(); |
| 80 | logger.info("ACK请求: platformGbId->{}", platformGbId); | 95 | logger.info("ACK请求: platformGbId->{}", platformGbId); |
| 96 | + ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformGbId); | ||
| 81 | // 取消设置的超时任务 | 97 | // 取消设置的超时任务 |
| 82 | dynamicTask.stop(callIdHeader.getCallId()); | 98 | dynamicTask.stop(callIdHeader.getCallId()); |
| 83 | String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser(); | 99 | String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser(); |
| @@ -98,7 +114,19 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -98,7 +114,19 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 98 | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); | 114 | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); |
| 99 | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); | 115 | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); |
| 100 | JSONObject jsonObject = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param); | 116 | JSONObject jsonObject = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param); |
| 101 | - System.out.println(jsonObject); | 117 | + if (jsonObject == null) { |
| 118 | + logger.error("RTP推流失败: 请检查ZLM服务"); | ||
| 119 | + } else if (jsonObject.getInteger("code") == 0) { | ||
| 120 | + logger.info("RTP推流成功[ {}/{} ],{}->{}:{}, " ,param.get("app"), param.get("stream"), jsonObject.getString("local_port"), param.get("dst_url"), param.get("dst_port")); | ||
| 121 | + } else { | ||
| 122 | + logger.error("RTP推流失败: {}, 参数:{}",jsonObject.getString("msg"),JSONObject.toJSON(param)); | ||
| 123 | + if (sendRtpItem.isOnlyAudio()) { | ||
| 124 | + // TODO 可能是语音对讲 | ||
| 125 | + }else { | ||
| 126 | + // 向上级平台 | ||
| 127 | + commanderForPlatform.streamByeCmd(parentPlatform, callIdHeader.getCallId()); | ||
| 128 | + } | ||
| 129 | + } | ||
| 102 | 130 | ||
| 103 | 131 | ||
| 104 | // if (streamInfo == null) { // 流还没上来,对方就回复ack | 132 | // if (streamInfo == null) { // 流还没上来,对方就回复ack |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.SipConfig; | ||
| 4 | -import com.genersoft.iot.vmp.conf.UserSetting; | ||
| 5 | import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; | 3 | import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.*; | 4 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 8 | -import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch; | ||
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| 14 | -import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; | ||
| 15 | -import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | ||
| 16 | -import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | ||
| 17 | -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 18 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 19 | import org.dom4j.DocumentException; | 10 | import org.dom4j.DocumentException; |
| 20 | import org.dom4j.Element; | 11 | import org.dom4j.Element; |
| 21 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| @@ -23,7 +14,6 @@ import org.slf4j.LoggerFactory; | @@ -23,7 +14,6 @@ import org.slf4j.LoggerFactory; | ||
| 23 | import org.springframework.beans.factory.InitializingBean; | 14 | import org.springframework.beans.factory.InitializingBean; |
| 24 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | import org.springframework.stereotype.Component; | 16 | import org.springframework.stereotype.Component; |
| 26 | -import org.springframework.util.StringUtils; | ||
| 27 | 17 | ||
| 28 | import javax.sip.InvalidArgumentException; | 18 | import javax.sip.InvalidArgumentException; |
| 29 | import javax.sip.RequestEvent; | 19 | import javax.sip.RequestEvent; |
| @@ -34,7 +24,6 @@ import java.text.SimpleDateFormat; | @@ -34,7 +24,6 @@ import java.text.SimpleDateFormat; | ||
| 34 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
| 35 | import java.util.Iterator; | 25 | import java.util.Iterator; |
| 36 | import java.util.List; | 26 | import java.util.List; |
| 37 | -import java.util.UUID; | ||
| 38 | 27 | ||
| 39 | import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText; | 28 | import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText; |
| 40 | 29 |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| @@ -246,17 +246,7 @@ public class ZLMRTPServerFactory { | @@ -246,17 +246,7 @@ public class ZLMRTPServerFactory { | ||
| 246 | * 调用zlm RESTFUL API —— startSendRtp | 246 | * 调用zlm RESTFUL API —— startSendRtp |
| 247 | */ | 247 | */ |
| 248 | public JSONObject startSendRtpStream(MediaServerItem mediaServerItem, Map<String, Object>param) { | 248 | public JSONObject startSendRtpStream(MediaServerItem mediaServerItem, Map<String, Object>param) { |
| 249 | - Boolean result = false; | ||
| 250 | - JSONObject jsonObject = zlmresTfulUtils.startSendRtp(mediaServerItem, param); | ||
| 251 | - if (jsonObject == null) { | ||
| 252 | - logger.error("RTP推流失败: 请检查ZLM服务"); | ||
| 253 | - } else if (jsonObject.getInteger("code") == 0) { | ||
| 254 | - result= true; | ||
| 255 | - logger.info("RTP推流成功[ {}/{} ],{}->{}:{}, " ,param.get("app"), param.get("stream"), jsonObject.getString("local_port"), param.get("dst_url"), param.get("dst_port")); | ||
| 256 | - } else { | ||
| 257 | - logger.error("RTP推流失败: {}, 参数:{}",jsonObject.getString("msg"),JSONObject.toJSON(param)); | ||
| 258 | - } | ||
| 259 | - return jsonObject; | 249 | + return zlmresTfulUtils.startSendRtp(mediaServerItem, param); |
| 260 | } | 250 | } |
| 261 | 251 | ||
| 262 | /** | 252 | /** |