648540858
2023-03-21 82adc0cb23f3ee47322e78889cdaba57e9309000
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java
@@ -1,8 +1,11 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.timeout.impl;
import com.genersoft.iot.vmp.conf.SystemInfoTimerTask;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
import com.genersoft.iot.vmp.gb28181.transmit.event.timeout.ITimeoutProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -12,6 +15,8 @@
@Component
public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor {
    private Logger logger = LoggerFactory.getLogger(TimeoutProcessorImpl.class);
    @Autowired
    private SIPProcessorObserver processorObserver;
@@ -26,11 +31,17 @@
    @Override
    public void process(TimeoutEvent event) {
        // TODO Auto-generated method stub
        CallIdHeader callIdHeader = event.getClientTransaction().getDialog().getCallId();
        String callId = callIdHeader.getCallId();
        SipSubscribe.Event errorSubscribe = sipSubscribe.getErrorSubscribe(callId);
        SipSubscribe.EventResult<TimeoutEvent> timeoutEventEventResult = new SipSubscribe.EventResult<>(event);
        errorSubscribe.response(timeoutEventEventResult);
        try {
            // TODO Auto-generated method stub
            CallIdHeader callIdHeader = event.getClientTransaction().getDialog().getCallId();
            String callId = callIdHeader.getCallId();
            SipSubscribe.Event errorSubscribe = sipSubscribe.getErrorSubscribe(callId);
            SipSubscribe.EventResult<TimeoutEvent> timeoutEventEventResult = new SipSubscribe.EventResult<>(event);
            errorSubscribe.response(timeoutEventEventResult);
            sipSubscribe.removeErrorSubscribe(callId);
            sipSubscribe.removeOkSubscribe(callId);
        } catch (Exception e) {
            logger.error("[超时事件失败]: {}", e.getMessage());
        }
    }
}