| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl; |
| | | |
| | | //import com.genersoft.iot.vmp.conf.SipConfig; |
| | | //import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.conf.MediaConfig; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; |
| | | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| | | //import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderPlarformProvider; |
| | | //import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderProvider; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | //import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | // import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.lang.Nullable; |
| | |
| | | import javax.sip.header.WWWAuthenticateHeader; |
| | | import javax.sip.message.Request; |
| | | import java.text.ParseException; |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | import java.util.UUID; |
| | | |
| | | @Component |
| | | @DependsOn("sipLayer") |
| | | public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| | | |
| | | private final Logger logger = LoggerFactory.getLogger(SIPCommanderFroPlatform.class); |
| | | |
| | | // @Autowired |
| | | // private SipConfig sipConfig; |
| | |
| | | @Qualifier(value="udpSipProvider") |
| | | private SipProvider udpSipProvider; |
| | | |
| | | @Value("${media.rtp.enable}") |
| | | private boolean rtpEnable; |
| | | |
| | | @Override |
| | | public boolean register(ParentPlatform parentPlatform) { |
| | | return register(parentPlatform, null, null, null, null); |
| | | public boolean register(ParentPlatform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) { |
| | | return register(parentPlatform, null, null, errorEvent, okEvent); |
| | | } |
| | | |
| | | @Override |
| | |
| | | // 将 callid 写入缓存, 等注册成功可以更新状态 |
| | | redisCatchStorage.updatePlatformRegisterInfo(callIdHeader.getCallId(), parentPlatform.getServerGBId()); |
| | | |
| | | CallIdHeader finalCallIdHeader = callIdHeader; |
| | | sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (event)->{ |
| | | redisCatchStorage.delPlatformRegisterInfo(finalCallIdHeader.getCallId()); |
| | | if (errorEvent != null) { |
| | | if (event != null) { |
| | | logger.info("向上级平台 [ {} ] 注册发上错误: {} ", |
| | | parentPlatform.getServerGBId(), |
| | | event.getResponse().getReasonPhrase()); |
| | | } |
| | | if (errorEvent != null ) { |
| | | errorEvent.response(event); |
| | | } |
| | | }); |
| | | |
| | | }else { |
| | | CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() |
| | | : udpSipProvider.getNewCallId(); |