Merge pull request #15 from lawrencehj/wvp-28181-2.0

修复编译后运行报错“循环依赖”的问题,修复zlm在docker时代理错误
This commit is contained in:
648540858 2020-12-18 09:25:41 +08:00 committed by GitHub
commit a63ae08f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -13,6 +13,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.conf.SipConfig;
@ -79,6 +80,7 @@ public class SIPProcessorFactory {
private CancelResponseProcessor cancelResponseProcessor; private CancelResponseProcessor cancelResponseProcessor;
@Autowired @Autowired
@Lazy
private RegisterResponseProcessor registerResponseProcessor; private RegisterResponseProcessor registerResponseProcessor;
@Autowired @Autowired

View File

@ -214,7 +214,7 @@ public class SIPRequestHeaderProvider {
.createSipURI(platform.getDeviceGBId(), sipAddress)); .createSipURI(platform.getDeviceGBId(), sipAddress));
request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(3600); ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(Integer.parseInt(platform.getExpires()));
request.addHeader(expires); request.addHeader(expires);
return request; return request;

View File

@ -1,10 +1,12 @@
package com.genersoft.iot.vmp.media.zlm; package com.genersoft.iot.vmp.media.zlm;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.conf.MediaServerConfig;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest; import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -27,6 +29,8 @@ public class ZLMHTTPProxyController {
@Autowired @Autowired
private IVideoManagerStorager storager; private IVideoManagerStorager storager;
@Value("${media.port}")
private int mediaHttpPort;
@ResponseBody @ResponseBody
@RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8")
@ -35,11 +39,12 @@ public class ZLMHTTPProxyController {
if (storager.getMediaInfo() == null) { if (storager.getMediaInfo() == null) {
return "未接入流媒体"; return "未接入流媒体";
} }
MediaServerConfig mediaInfo = storager.getMediaInfo();
String requestURI = String.format("http://%s:%s%s?%s&%s", String requestURI = String.format("http://%s:%s%s?%s&%s",
storager.getMediaInfo().getLocalIP(), mediaInfo.getLocalIP(),
storager.getMediaInfo().getHttpPort(), mediaHttpPort,
request.getRequestURI().replace("/zlm",""), request.getRequestURI().replace("/zlm",""),
storager.getMediaInfo().getHookAdminParams(), mediaInfo.getHookAdminParams(),
request.getQueryString() request.getQueryString()
); );
// 发送请求 // 发送请求