| | |
| | | |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.device.DeviceQuery; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | |
| | | |
| | | |
| | | @Configuration("mediaConfig") |
| | | @Order(0) |
| | | public class MediaConfig{ |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(MediaConfig.class); |
| | |
| | | @Value("${media.rtp.port-range}") |
| | | private String rtpPortRange; |
| | | |
| | | |
| | | @Value("${media.rtp.send-port-range}") |
| | | private String sendRtpPortRange; |
| | | private String rtpSendPortRange; |
| | | |
| | | @Value("${media.record-assist-port:0}") |
| | | private Integer recordAssistPort = 0; |
| | | |
| | | @Value("${media.record-day:7}") |
| | | private Integer recordDay; |
| | | |
| | | @Value("${media.record-path:}") |
| | | private String recordPath; |
| | | |
| | | public String getId() { |
| | | return id; |
| | |
| | | |
| | | public String getHookIp() { |
| | | if (ObjectUtils.isEmpty(hookIp)){ |
| | | return sipIp.split(",")[0]; |
| | | return sipIp; |
| | | }else { |
| | | return hookIp; |
| | | } |
| | |
| | | return sipDomain; |
| | | } |
| | | |
| | | public String getSendRtpPortRange() { |
| | | return sendRtpPortRange; |
| | | } |
| | | |
| | | public MediaServerItem getMediaSerItem(){ |
| | | MediaServerItem mediaServerItem = new MediaServerItem(); |
| | | mediaServerItem.setId(id); |
| | |
| | | mediaServerItem.setSecret(secret); |
| | | mediaServerItem.setRtpEnable(rtpEnable); |
| | | mediaServerItem.setRtpPortRange(rtpPortRange); |
| | | mediaServerItem.setSendRtpPortRange(sendRtpPortRange); |
| | | mediaServerItem.setSendRtpPortRange(rtpSendPortRange); |
| | | mediaServerItem.setRecordAssistPort(recordAssistPort); |
| | | mediaServerItem.setHookAliveInterval(120); |
| | | |
| | | mediaServerItem.setHookAliveInterval(30.00f); |
| | | mediaServerItem.setRecordDay(recordDay); |
| | | if (recordPath != null) { |
| | | mediaServerItem.setRecordPath(recordPath); |
| | | } |
| | | mediaServerItem.setCreateTime(DateUtil.getNow()); |
| | | mediaServerItem.setUpdateTime(DateUtil.getNow()); |
| | | |
| | | return mediaServerItem; |
| | | } |
| | | |
| | | public Integer getRecordDay() { |
| | | return recordDay; |
| | | } |
| | | |
| | | public void setRecordDay(Integer recordDay) { |
| | | this.recordDay = recordDay; |
| | | } |
| | | |
| | | public String getRecordPath() { |
| | | return recordPath; |
| | | } |
| | | |
| | | public void setRecordPath(String recordPath) { |
| | | this.recordPath = recordPath; |
| | | } |
| | | |
| | | public String getRtpSendPortRange() { |
| | | return rtpSendPortRange; |
| | | } |
| | | |
| | | public void setRtpSendPortRange(String rtpSendPortRange) { |
| | | this.rtpSendPortRange = rtpSendPortRange; |
| | | } |
| | | |
| | | private boolean isValidIPAddress(String ipAddress) { |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |