648540858
2022-08-23 8f7e8efc981cf68a3067fb3421fdfbbf6f6275ab
合并主线
11个文件已修改
344 ■■■■■ 已修改文件
sql/update.sql 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web_src/src/components/dialog/devicePlayer.vue 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sql/update.sql
@@ -1,99 +0,0 @@
alter table parent_platform
    add startOfflinePush int default 0 null;
alter table parent_platform
    add administrativeDivision varchar(50) not null;
alter table parent_platform
    add catalogGroup int default 1 null;
alter table device
    add audioChannelForReceive VARCHAR(50) null;
alter table device
    add audioChannelForSend VARCHAR(50) null;
alter table stream_push
    add serverId varchar(50) not null;
alter table device
    add geoCoordSys varchar(50) not null;
alter table device
    add treeType varchar(50) not null;
update device set device.geoCoordSys='WGS84';
update device set device.treeType='CivilCode';
alter table device_channel
    add longitudeGcj02 double default null;
alter table device_channel
    add latitudeGcj02 double default null;
alter table device_channel
    add longitudeWgs84 double default null;
alter table device_channel
    add latitudeWgs84 double default null;
alter table device_channel
    add businessGroupId varchar(50) default null;
alter table device_channel
    add gpsTime varchar(50) default null;
alter table device_mobile_position
    change  cnLng longitudeGcj02 double default null;
alter table device_mobile_position
    change  cnLat latitudeGcj02 double default null;
alter table device_mobile_position
    add longitudeWgs84 double default null;
alter table device_mobile_position
    add latitudeWgs84 double default null;
alter table device_mobile_position
    drop geodeticSystem;
alter table device_mobile_position
    add createTime varchar(50) default null;
alter table device_alarm
    add createTime varchar(50) default null;
alter table gb_stream
    change createStamp createTime varchar(50) default null;
alter table parent_platform
    add createTime varchar(50) default null;
alter table parent_platform
    add updateTime varchar(50) default null;
alter table stream_proxy
    add updateTime varchar(50) default null;
alter table stream_push
    add pushTime varchar(50) default null;
alter table stream_push
    add status int DEFAULT NULL;
alter table stream_push
    add updateTime varchar(50) default null;
alter table stream_push
    add pushIng int DEFAULT NULL;
alter table stream_push
    change createStamp createTime varchar(50) default null;
alter table gb_stream
    drop column status;
alter table user
    add pushKey varchar(50) default null;
update user set pushKey='453df297a57a5a7438934sda801fc3' where id=1;
alter table parent_platform
    add treeType varchar(50) not null;
update parent_platform set parent_platform.treeType='BusinessGroup';
alter table parent_platform drop shareAllLiveStream;
alter table platform_catalog
    add civilCode varchar(50) default null;
alter table platform_catalog
    add businessGroupId varchar(50) default null;
/********************* ADD ***************************/
alter table stream_push
    add self int DEFAULT NULL;
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
@@ -10,6 +10,7 @@
import gov.nist.javax.sip.stack.SIPDialog;
import javax.sip.Dialog;
import javax.sip.InvalidArgumentException;
import javax.sip.SipException;
import java.text.ParseException;
@@ -127,7 +128,7 @@
     */
    void streamByeCmd(String deviceId, String channelId, String stream, String callId, SipSubscribe.Event okEvent);
    void streamByeCmd(String deviceId, String channelId, String stream, String callId);
    void streamByeCmd(SIPDialog dialog, SIPRequest request, SipSubscribe.Event okEvent) throws SipException, ParseException;
    void streamByeCmd(SIPDialog dialog, String channelId, SIPRequest request, SipSubscribe.Event okEvent) throws SipException, ParseException, InvalidArgumentException;
    /**
     * 回放暂停
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -676,6 +676,46 @@
        streamByeCmd(deviceId, channelId, stream, callId, null);
    }
    @Override
    public void streamByeCmd(SIPDialog dialog, String channelId, SIPRequest request, SipSubscribe.Event okEvent) throws SipException, ParseException, InvalidArgumentException {
        Request byeRequest = dialog.createRequest(Request.BYE);
        SipURI byeURI = (SipURI) byeRequest.getRequestURI();
        byeURI.setHost(request.getRemoteAddress().getHostAddress());
        byeURI.setPort(request.getRemotePort());
        byeURI.setUser(channelId);
        ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME);
        String protocol = viaHeader.getTransport().toUpperCase();
        viaHeader.setRPort();
        // 增加Contact header
        Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
        byeRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
        List<String> agentParam = new ArrayList<>();
        agentParam.add("wvp-pro");
        // TODO 添加版本信息以及日期
        UserAgentHeader userAgentHeader = null;
        try {
            userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
        byeRequest.addHeader(userAgentHeader);
        ClientTransaction clientTransaction = null;
        if("TCP".equals(protocol)) {
            clientTransaction = tcpSipProvider.getNewClientTransaction(byeRequest);
        } else if("UDP".equals(protocol)) {
            clientTransaction = udpSipProvider.getNewClientTransaction(byeRequest);
        }
        CallIdHeader callIdHeader = (CallIdHeader) byeRequest.getHeader(CallIdHeader.NAME);
        if (okEvent != null) {
            sipSubscribe.addOkSubscribe(callIdHeader.getCallId(), okEvent);
        }
        CSeqHeader cSeqHeader = (CSeqHeader)byeRequest.getHeader(CSeqHeader.NAME);
        cSeqHeader.setSeqNumber(redisCatchStorage.getCSEQ());
        dialog.sendRequest(clientTransaction);
    }
    /**
     * 视频流停止
     */
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
@@ -26,10 +26,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.sip.Dialog;
import javax.sip.DialogState;
import javax.sip.RequestEvent;
import javax.sip.SipException;
import javax.sip.*;
import javax.sip.address.SipURI;
import javax.sip.header.CallIdHeader;
import javax.sip.header.FromHeader;
@@ -151,11 +148,13 @@
                if (sendRtpItem.isOnlyAudio()) {
                    // 语音对讲
                    try {
                        cmder.streamByeCmd((SIPDialog) evt.getDialog(), (SIPRequest) evt.getRequest(), null);
                        cmder.streamByeCmd((SIPDialog) evt.getDialog(), sendRtpItem.getChannelId(), (SIPRequest) evt.getRequest(), null);
                    } catch (SipException e) {
                        throw new RuntimeException(e);
                    } catch (ParseException e) {
                        throw new RuntimeException(e);
                    } catch (InvalidArgumentException e) {
                        throw new RuntimeException(e);
                    }
                } else {
                    // 向上级平台
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
@@ -90,12 +90,6 @@
    @Autowired
    private IVideoManagerStorage storager;
    @Autowired
    private IStreamProxyService streamProxyService;
    @Autowired
    private EventPublisher publisher;
    /**
@@ -288,6 +282,7 @@
        return (MediaServerItem)RedisUtil.get(key);
    }
    @Override
    public MediaServerItem getDefaultMediaServer() {
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
@@ -25,11 +25,7 @@
    private IRedisCatchStorage redisCatchStorage;
    @Autowired
    private IVideoManagerStorage storager;
    @Autowired
    private IMediaServerService mediaServerService;
    @Autowired
    private MediaConfig mediaConfig;
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -4,6 +4,7 @@
import java.math.RoundingMode;
import java.util.*;
import javax.sip.InvalidArgumentException;
import javax.sip.ResponseEvent;
import com.genersoft.iot.vmp.gb28181.bean.*;
@@ -745,7 +746,7 @@
                    zlmresTfulUtils.closeStreams(mediaInfo, sendRtpItem.getApp(), sendRtpItem.getStreamId());
                }
                if (audioBroadcastCatch.getStatus() == AudioBroadcastCatchStatus.Ok) {
                    cmder.streamByeCmd(audioBroadcastCatch.getDialog(), audioBroadcastCatch.getRequest(), null);
                    cmder.streamByeCmd(audioBroadcastCatch.getDialog(), audioBroadcastCatch.getChannelId(), audioBroadcastCatch.getRequest(), null);
                }
                audioBroadcastManager.del(deviceId, channelId);
@@ -753,6 +754,8 @@
                throw new RuntimeException(e);
            } catch (ParseException e) {
                throw new RuntimeException(e);
            } catch (InvalidArgumentException e) {
                throw new RuntimeException(e);
            }
        }
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
@@ -77,12 +77,6 @@
    private PlatformGbStreamMapper platformGbStreamMapper;
    @Autowired
    private EventPublisher eventPublisher;
    @Autowired
    private ParentPlatformMapper parentPlatformMapper;
    @Autowired
    private IGbStreamService gbStreamService;
    @Autowired
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
@@ -197,9 +197,11 @@
    @Operation(summary = "语音广播命令")
    @Parameter(name = "deviceId", description = "设备国标编号", required = true)
    @GetMapping("/broadcast/{deviceId}")
    @PostMapping("/broadcast/{deviceId}")
    public DeferredResult<WVPResult<AudioBroadcastResult>> broadcastApi(@PathVariable String deviceId) {
    @Parameter(name = "deviceId", description = "通道国标编号", required = true)
    @Parameter(name = "timeout", description = "推流超时时间(秒)", required = true)
    @GetMapping("/broadcast/{deviceId}/{channelId}")
    @PostMapping("/broadcast/{deviceId}/{channelId}")
    public DeferredResult<WVPResult<AudioBroadcastResult>> broadcastApi(@PathVariable String deviceId, @PathVariable String channelId, Integer timeout) {
        if (logger.isDebugEnabled()) {
            logger.debug("语音广播API调用");
        }
@@ -258,13 +260,10 @@
        return result;
    }
    @Operation(summary = "获取所有的ssrc")
    @ApiOperation("停止语音广播")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "deviceId", value = "设备Id", dataTypeClass = String.class),
            @ApiImplicitParam(name = "channelId", value = "通道Id", dataTypeClass = String.class),
    })
    @Operation(summary = "停止语音广播")
    @Parameter(name = "deviceId", description = "设备Id", required = true)
    @Parameter(name = "channelId", description = "通道Id", required = true)
    @GetMapping("/broadcast/stop/{deviceId}/{channelId}")
    @PostMapping("/broadcast/stop/{deviceId}/{channelId}")
    public WVPResult<String> stopBroadcastA(@PathVariable String deviceId, @PathVariable String channelId) {
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
@@ -199,4 +199,15 @@
            }
        }
    }
    @PostMapping("/userInfo")
    @Operation(summary = "管理员修改普通用户密码")
    public LoginUser getUserInfo() {
        // 获取当前登录用户id
        LoginUser userInfo = SecurityUtils.getUserInfo();
        if (userInfo == null) {
            throw new ControllerException(ErrorCode.ERROR100);
        }
        return userInfo;
    }
}
web_src/src/components/dialog/devicePlayer.vue
@@ -871,76 +871,91 @@
            }
        },
        startBroadcast(url){
          // 获取推流鉴权KEY
          console.log(this.$loginUser)
          console.log(this.$loginUser.pushKey)
          url += "&sign=" + crypto.createHash('md5').update(this.$loginUser.pushKey, "utf8").digest('hex')
          console.log("开始语音对讲: " + url)
          this.broadcastRtc = new ZLMRTCClient.Endpoint({
            debug: true, // 是否打印日志
            zlmsdpUrl: url, //流地址
            simulecast: false,
            useCamera: false,
            audioEnable: true,
            videoEnable: false,
            recvOnly: false,
          })
          // 获取推流鉴权Key
          this.$axios({
            method: 'post',
            url: '/api/user/userInfo',
          }).then( (res)=> {
            if (res.data.code !== 0) {
              this.$message({
                showClose: true,
                message: "获取推流鉴权Key失败",
                type: "error",
              });
            }else {
              let pushKey = res.data.data.pushKey;
              // 获取推流鉴权KEY
              url += "&sign=" + crypto.createHash('md5').update(pushKey, "utf8").digest('hex')
              console.log("开始语音对讲: " + url)
              this.broadcastRtc = new ZLMRTCClient.Endpoint({
                debug: true, // 是否打印日志
                zlmsdpUrl: url, //流地址
                simulecast: false,
                useCamera: false,
                audioEnable: true,
                videoEnable: false,
                recvOnly: false,
              })
          // webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//获取到了远端流,可以播放
          //   console.error('播放成功',e.streams)
          //   this.broadcastStatus = 1;
          // });
          //
          // webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_LOCAL_STREAM,(s)=>{// 获取到了本地流
          //   this.broadcastStatus = 1;
          //   // document.getElementById('selfVideo').srcObject=s;
          //   // this.eventcallbacK("LOCAL STREAM", "获取到了本地流")
          // });
              // webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//获取到了远端流,可以播放
              //   console.error('播放成功',e.streams)
              //   this.broadcastStatus = 1;
              // });
              //
              // webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_LOCAL_STREAM,(s)=>{// 获取到了本地流
              //   this.broadcastStatus = 1;
              //   // document.getElementById('selfVideo').srcObject=s;
              //   // this.eventcallbacK("LOCAL STREAM", "获取到了本地流")
              // });
          this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_NOT_SUPPORT,(e)=>{// 获取到了本地流
            console.error('不支持webrtc',e)
            this.$message({
              showClose: true,
              message: '不支持webrtc, 无法进行语音对讲',
              type: 'error'
            });
          });
              this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_NOT_SUPPORT,(e)=>{// 获取到了本地流
                console.error('不支持webrtc',e)
                this.$message({
                  showClose: true,
                  message: '不支持webrtc, 无法进行语音对讲',
                  type: 'error'
                });
              });
          this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(e)=>{// ICE 协商出错
            console.error('ICE 协商出错')
            this.$message({
              showClose: true,
              message: 'ICE 协商出错',
              type: 'error'
            });
          });
              this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(e)=>{// ICE 协商出错
                console.error('ICE 协商出错')
                this.$message({
                  showClose: true,
                  message: 'ICE 协商出错',
                  type: 'error'
                });
              });
          this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(e)=>{// offer anwser 交换失败
            console.error('offer anwser 交换失败',e)
            this.$message({
              showClose: true,
              message: 'offer anwser 交换失败' + e,
              type: 'error'
            });
          });
          this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ON_CONNECTION_STATE_CHANGE,(e)=>{// offer anwser 交换失败
            console.log('状态改变',e)
            if (e === "connecting") {
              this.broadcastStatus = 0;
            }else if (e === "connected") {
              this.broadcastStatus = 1;
            }else if (e === "disconnected") {
              this.broadcastStatus = -1;
              this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(e)=>{// offer anwser 交换失败
                console.error('offer anwser 交换失败',e)
                this.$message({
                  showClose: true,
                  message: 'offer anwser 交换失败' + e,
                  type: 'error'
                });
              });
              this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ON_CONNECTION_STATE_CHANGE,(e)=>{// offer anwser 交换失败
                console.log('状态改变',e)
                if (e === "connecting") {
                  this.broadcastStatus = 0;
                }else if (e === "connected") {
                  this.broadcastStatus = 1;
                }else if (e === "disconnected") {
                  this.broadcastStatus = -1;
                }
              });
              this.broadcastRtc.on(ZLMRTCClient.Events.CAPTURE_STREAM_FAILED,(e)=>{// offer anwser 交换失败
                console.log('捕获流失败',e)
                this.$message({
                  showClose: true,
                  message: '捕获流失败' + e,
                  type: 'error'
                });
              });
            }
          });
          this.broadcastRtc.on(ZLMRTCClient.Events.CAPTURE_STREAM_FAILED,(e)=>{// offer anwser 交换失败
            console.log('捕获流失败',e)
            this.$message({
              showClose: true,
              message: '捕获流失败' + e,
              type: 'error'
            });
          });
        },
        stopBroadcast(){
          this.broadcastStatus = -2;