Commit a63ae08f5d8e54855468c24d79a2d7e1c524244c
Committed by
GitHub
Merge pull request #15 from lawrencehj/wvp-28181-2.0
修复编译后运行报错“循环依赖”的问题,修复zlm在docker时代理错误
Showing
3 changed files
with
11 additions
and
4 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorFactory.java
| ... | ... | @@ -13,6 +13,7 @@ import org.slf4j.Logger; |
| 13 | 13 | import org.slf4j.LoggerFactory; |
| 14 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 15 | import org.springframework.beans.factory.annotation.Qualifier; |
| 16 | +import org.springframework.context.annotation.Lazy; | |
| 16 | 17 | import org.springframework.stereotype.Component; |
| 17 | 18 | |
| 18 | 19 | import com.genersoft.iot.vmp.conf.SipConfig; |
| ... | ... | @@ -79,6 +80,7 @@ public class SIPProcessorFactory { |
| 79 | 80 | private CancelResponseProcessor cancelResponseProcessor; |
| 80 | 81 | |
| 81 | 82 | @Autowired |
| 83 | + @Lazy | |
| 82 | 84 | private RegisterResponseProcessor registerResponseProcessor; |
| 83 | 85 | |
| 84 | 86 | @Autowired | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
| ... | ... | @@ -214,7 +214,7 @@ public class SIPRequestHeaderProvider { |
| 214 | 214 | .createSipURI(platform.getDeviceGBId(), sipAddress)); |
| 215 | 215 | request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); |
| 216 | 216 | |
| 217 | - ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(3600); | |
| 217 | + ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(Integer.parseInt(platform.getExpires())); | |
| 218 | 218 | request.addHeader(expires); |
| 219 | 219 | |
| 220 | 220 | return request; | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java
| 1 | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.genersoft.iot.vmp.conf.MediaServerConfig; | |
| 4 | 5 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 5 | 6 | import org.slf4j.Logger; |
| 6 | 7 | import org.slf4j.LoggerFactory; |
| 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.beans.factory.annotation.Value; | |
| 8 | 10 | import org.springframework.http.HttpHeaders; |
| 9 | 11 | import org.springframework.http.HttpRequest; |
| 10 | 12 | import org.springframework.http.HttpStatus; |
| ... | ... | @@ -27,6 +29,8 @@ public class ZLMHTTPProxyController { |
| 27 | 29 | @Autowired |
| 28 | 30 | private IVideoManagerStorager storager; |
| 29 | 31 | |
| 32 | + @Value("${media.port}") | |
| 33 | + private int mediaHttpPort; | |
| 30 | 34 | |
| 31 | 35 | @ResponseBody |
| 32 | 36 | @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") |
| ... | ... | @@ -35,11 +39,12 @@ public class ZLMHTTPProxyController { |
| 35 | 39 | if (storager.getMediaInfo() == null) { |
| 36 | 40 | return "未接入流媒体"; |
| 37 | 41 | } |
| 42 | + MediaServerConfig mediaInfo = storager.getMediaInfo(); | |
| 38 | 43 | String requestURI = String.format("http://%s:%s%s?%s&%s", |
| 39 | - storager.getMediaInfo().getLocalIP(), | |
| 40 | - storager.getMediaInfo().getHttpPort(), | |
| 44 | + mediaInfo.getLocalIP(), | |
| 45 | + mediaHttpPort, | |
| 41 | 46 | request.getRequestURI().replace("/zlm",""), |
| 42 | - storager.getMediaInfo().getHookAdminParams(), | |
| 47 | + mediaInfo.getHookAdminParams(), | |
| 43 | 48 | request.getQueryString() |
| 44 | 49 | ); |
| 45 | 50 | // 发送请求 | ... | ... |