SipRequestBuilder 修正

This commit is contained in:
shikong 2023-09-20 09:39:58 +08:00
parent 39b65a2aee
commit 65b492f8e7
4 changed files with 14 additions and 12 deletions

View File

@ -1,5 +1,6 @@
package cn.skcks.docking.gb28181.wvp.service.catalog;
import cn.skcks.docking.gb28181.common.json.JsonException;
import cn.skcks.docking.gb28181.common.xml.XmlUtils;
import cn.skcks.docking.gb28181.core.sip.gb28181.constant.GB28181Constant;
import cn.skcks.docking.gb28181.core.sip.message.subscribe.GenericSubscribe;
@ -13,6 +14,7 @@ import cn.skcks.docking.gb28181.wvp.sip.sender.SipSender;
import cn.skcks.docking.gb28181.wvp.sip.subscribe.SipSubscribe;
import gov.nist.javax.sip.message.SIPRequest;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -29,10 +31,11 @@ public class CatalogService {
private final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
private final DockingService dockingService;
@SneakyThrows
public void getCatalog(String deviceId){
WvpProxyDocking device = dockingService.getDeviceByDeviceCode(deviceId).orElse(null);
if (device == null){
throw new RuntimeException("设备不存在");
throw new JsonException("设备不存在");
}
CatalogRequestDTO catalogRequestDTO = new CatalogRequestDTO();
catalogRequestDTO.setDeviceId(deviceId);

View File

@ -3,15 +3,14 @@ package cn.skcks.docking.gb28181.wvp.service.docking;
import cn.skcks.docking.gb28181.common.json.JsonException;
import cn.skcks.docking.gb28181.wvp.orm.mybatis.dynamic.mapper.WvpProxyDockingDynamicSqlSupport;
import cn.skcks.docking.gb28181.wvp.orm.mybatis.dynamic.mapper.WvpProxyDockingMapper;
import cn.skcks.docking.gb28181.wvp.orm.mybatis.dynamic.model.WvpProxyDevice;
import cn.skcks.docking.gb28181.wvp.orm.mybatis.dynamic.model.WvpProxyDocking;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.MessageFormat;
import java.util.Optional;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
@ -42,6 +41,7 @@ public class DockingService {
* @return 是否成功
*/
@SneakyThrows
@Transactional
public boolean addDevice(WvpProxyDocking device) {
if(device == null){
return false;

View File

@ -13,7 +13,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;
import javax.sip.SipFactory;
import javax.sip.address.Address;
@ -22,7 +21,6 @@ import javax.sip.header.*;
import javax.sip.message.Request;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
@DependsOn("proxySipConfig")
@Component
@ -100,11 +98,11 @@ public class SipRequestBuilder implements ApplicationContextAware {
String from = StringUtils.joinWith(":", ip, port);
// from
SipURI fromSipURI = MessageHelper.createSipURI(device.getGbDeviceId(), from);
SipURI fromSipURI = MessageHelper.createSipURI(sipConfig.getId(), from);
Address fromAddress = MessageHelper.createAddress(fromSipURI);
FromHeader fromHeader = MessageHelper.createFromHeader(fromAddress, fromTag);
// to
SipURI toSipURI = MessageHelper.createSipURI(sipConfig.getId(), target);
SipURI toSipURI = MessageHelper.createSipURI(device.getGbDeviceId(), target);
Address toAddress = MessageHelper.createAddress(toSipURI);
ToHeader toHeader = MessageHelper.createToHeader(toAddress, null);

View File

@ -24,8 +24,8 @@ spring:
username: root
password: 123456a
url: jdbc:mysql://192.168.1.241:3306/gb28181_docking_platform?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
profiles:
active: local
# profiles:
# active: local
cloud:
openfeign:
httpclient:
@ -54,12 +54,13 @@ proxy:
use-ffmpeg: false
gb28181:
sip:
id: 44050100002000000003
id: 44050100002000000004
domain: 4405010000
password: 123456
port: 5063
ip:
- 192.168.3.10
- 192.168.0.195
# - 192.168.3.10
# - 192.168.1.241
ffmpeg-support:
@ -72,5 +73,5 @@ ffmpeg-support:
output: -vcodec h264 -acodec aac -movflags empty_moov+frag_keyframe+default_base_moof -f mp4 # -rtsp_transport tcp
debug:
download: false
input: true
input: false
output: false