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 | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | 5 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 6 | 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 | 9 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| 8 | 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 | 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| 10 | 14 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 11 | 15 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| ... | ... | @@ -13,6 +17,8 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 13 | 17 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 14 | 18 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 15 | 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 | 22 | import org.slf4j.Logger; |
| 17 | 23 | import org.slf4j.LoggerFactory; |
| 18 | 24 | import org.springframework.beans.factory.InitializingBean; |
| ... | ... | @@ -51,6 +57,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In |
| 51 | 57 | private IRedisCatchStorage redisCatchStorage; |
| 52 | 58 | |
| 53 | 59 | @Autowired |
| 60 | + private IVideoManagerStorage storager; | |
| 61 | + | |
| 62 | + @Autowired | |
| 54 | 63 | private ZLMRTPServerFactory zlmrtpServerFactory; |
| 55 | 64 | |
| 56 | 65 | @Autowired |
| ... | ... | @@ -62,6 +71,12 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In |
| 62 | 71 | @Autowired |
| 63 | 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 | 82 | * 处理 ACK请求 |
| ... | ... | @@ -78,6 +93,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In |
| 78 | 93 | if (dialog.getState()== DialogState.CONFIRMED) { |
| 79 | 94 | String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser(); |
| 80 | 95 | logger.info("ACK请求: platformGbId->{}", platformGbId); |
| 96 | + ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformGbId); | |
| 81 | 97 | // 取消设置的超时任务 |
| 82 | 98 | dynamicTask.stop(callIdHeader.getCallId()); |
| 83 | 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 | 114 | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); |
| 99 | 115 | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); |
| 100 | 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 | 132 | // if (streamInfo == null) { // 流还没上来,对方就回复ack | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java
| 1 | 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 | 3 | import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; |
| 6 | 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 | 5 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 10 | 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 11 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | 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 | 10 | import org.dom4j.DocumentException; |
| 20 | 11 | import org.dom4j.Element; |
| 21 | 12 | import org.slf4j.Logger; |
| ... | ... | @@ -23,7 +14,6 @@ import org.slf4j.LoggerFactory; |
| 23 | 14 | import org.springframework.beans.factory.InitializingBean; |
| 24 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | 16 | import org.springframework.stereotype.Component; |
| 26 | -import org.springframework.util.StringUtils; | |
| 27 | 17 | |
| 28 | 18 | import javax.sip.InvalidArgumentException; |
| 29 | 19 | import javax.sip.RequestEvent; |
| ... | ... | @@ -34,7 +24,6 @@ import java.text.SimpleDateFormat; |
| 34 | 24 | import java.util.ArrayList; |
| 35 | 25 | import java.util.Iterator; |
| 36 | 26 | import java.util.List; |
| 37 | -import java.util.UUID; | |
| 38 | 27 | |
| 39 | 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 | 246 | * 调用zlm RESTFUL API —— startSendRtp |
| 247 | 247 | */ |
| 248 | 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 | /** | ... | ... |