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,6 +13,7 @@ import org.slf4j.Logger; | ||
| 13 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.beans.factory.annotation.Qualifier; | 15 | import org.springframework.beans.factory.annotation.Qualifier; |
| 16 | +import org.springframework.context.annotation.Lazy; | ||
| 16 | import org.springframework.stereotype.Component; | 17 | import org.springframework.stereotype.Component; |
| 17 | 18 | ||
| 18 | import com.genersoft.iot.vmp.conf.SipConfig; | 19 | import com.genersoft.iot.vmp.conf.SipConfig; |
| @@ -79,6 +80,7 @@ public class SIPProcessorFactory { | @@ -79,6 +80,7 @@ public class SIPProcessorFactory { | ||
| 79 | private CancelResponseProcessor cancelResponseProcessor; | 80 | private CancelResponseProcessor cancelResponseProcessor; |
| 80 | 81 | ||
| 81 | @Autowired | 82 | @Autowired |
| 83 | + @Lazy | ||
| 82 | private RegisterResponseProcessor registerResponseProcessor; | 84 | private RegisterResponseProcessor registerResponseProcessor; |
| 83 | 85 | ||
| 84 | @Autowired | 86 | @Autowired |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
| @@ -214,7 +214,7 @@ public class SIPRequestHeaderProvider { | @@ -214,7 +214,7 @@ public class SIPRequestHeaderProvider { | ||
| 214 | .createSipURI(platform.getDeviceGBId(), sipAddress)); | 214 | .createSipURI(platform.getDeviceGBId(), sipAddress)); |
| 215 | request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); | 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 | request.addHeader(expires); | 218 | request.addHeader(expires); |
| 219 | 219 | ||
| 220 | return request; | 220 | return request; |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java
| 1 | package com.genersoft.iot.vmp.media.zlm; | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.genersoft.iot.vmp.conf.MediaServerConfig; | ||
| 4 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 5 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 5 | import org.slf4j.Logger; | 6 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 7 | import org.slf4j.LoggerFactory; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.beans.factory.annotation.Value; | ||
| 8 | import org.springframework.http.HttpHeaders; | 10 | import org.springframework.http.HttpHeaders; |
| 9 | import org.springframework.http.HttpRequest; | 11 | import org.springframework.http.HttpRequest; |
| 10 | import org.springframework.http.HttpStatus; | 12 | import org.springframework.http.HttpStatus; |
| @@ -27,6 +29,8 @@ public class ZLMHTTPProxyController { | @@ -27,6 +29,8 @@ public class ZLMHTTPProxyController { | ||
| 27 | @Autowired | 29 | @Autowired |
| 28 | private IVideoManagerStorager storager; | 30 | private IVideoManagerStorager storager; |
| 29 | 31 | ||
| 32 | + @Value("${media.port}") | ||
| 33 | + private int mediaHttpPort; | ||
| 30 | 34 | ||
| 31 | @ResponseBody | 35 | @ResponseBody |
| 32 | @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") | 36 | @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") |
| @@ -35,11 +39,12 @@ public class ZLMHTTPProxyController { | @@ -35,11 +39,12 @@ public class ZLMHTTPProxyController { | ||
| 35 | if (storager.getMediaInfo() == null) { | 39 | if (storager.getMediaInfo() == null) { |
| 36 | return "未接入流媒体"; | 40 | return "未接入流媒体"; |
| 37 | } | 41 | } |
| 42 | + MediaServerConfig mediaInfo = storager.getMediaInfo(); | ||
| 38 | String requestURI = String.format("http://%s:%s%s?%s&%s", | 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 | request.getRequestURI().replace("/zlm",""), | 46 | request.getRequestURI().replace("/zlm",""), |
| 42 | - storager.getMediaInfo().getHookAdminParams(), | 47 | + mediaInfo.getHookAdminParams(), |
| 43 | request.getQueryString() | 48 | request.getQueryString() |
| 44 | ); | 49 | ); |
| 45 | // 发送请求 | 50 | // 发送请求 |