old mode 100644
new mode 100755
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo; | 
|---|
|  |  |  | import gov.nist.javax.sip.message.SIPResponse; | 
|---|
|  |  |  | import org.slf4j.Logger; | 
|---|
|  |  |  | import org.slf4j.LoggerFactory; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.sip.InvalidArgumentException; | 
|---|
|  |  |  | import javax.sip.ResponseEvent; | 
|---|
|  |  |  | import javax.sip.header.CallIdHeader; | 
|---|
|  |  |  | import javax.sip.SipException; | 
|---|
|  |  |  | import javax.sip.header.WWWAuthenticateHeader; | 
|---|
|  |  |  | import javax.sip.message.Response; | 
|---|
|  |  |  | import java.text.ParseException; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @description:Register响应处理器 | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void process(ResponseEvent evt) { | 
|---|
|  |  |  | Response response = evt.getResponse(); | 
|---|
|  |  |  | CallIdHeader callIdHeader = (CallIdHeader) response.getHeader(CallIdHeader.NAME); | 
|---|
|  |  |  | String callId = callIdHeader.getCallId(); | 
|---|
|  |  |  | SIPResponse response = (SIPResponse)evt.getResponse(); | 
|---|
|  |  |  | String callId = response.getCallIdHeader().getCallId(); | 
|---|
|  |  |  | PlatformRegisterInfo platformRegisterInfo = redisCatchStorage.queryPlatformRegisterInfo(callId); | 
|---|
|  |  |  | if (platformRegisterInfo == null) { | 
|---|
|  |  |  | logger.info(String.format("[国标级联]未找到callId: %s 的注册/注销平台id", callId )); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (response.getStatusCode() == Response.UNAUTHORIZED) { | 
|---|
|  |  |  | WWWAuthenticateHeader www = (WWWAuthenticateHeader)response.getHeader(WWWAuthenticateHeader.NAME); | 
|---|
|  |  |  | sipCommanderForPlatform.register(parentPlatform, callId, www, null, null, true, platformRegisterInfo.isRegister()); | 
|---|
|  |  |  | SipTransactionInfo sipTransactionInfo = new SipTransactionInfo(response); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | sipCommanderForPlatform.register(parentPlatform, sipTransactionInfo, www, null, null, platformRegisterInfo.isRegister()); | 
|---|
|  |  |  | } catch (SipException | InvalidArgumentException | ParseException e) { | 
|---|
|  |  |  | logger.error("[命令发送失败] 国标级联 再次注册: {}", e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else if (response.getStatusCode() == Response.OK){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (platformRegisterInfo.isRegister()) { | 
|---|
|  |  |  | platformService.online(parentPlatform); | 
|---|
|  |  |  | SipTransactionInfo sipTransactionInfo = new SipTransactionInfo(response); | 
|---|
|  |  |  | platformService.online(parentPlatform, sipTransactionInfo); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | platformService.offline(parentPlatform); | 
|---|
|  |  |  | platformService.offline(parentPlatform, true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 注册/注销成功移除缓存的信息 | 
|---|