修复因发送失败消息捕捉导致的消息处理异常

This commit is contained in:
lin
2025-05-13 15:25:17 +08:00
parent 49f4306bb3
commit a83a48e40e
3 changed files with 1 additions and 34 deletions

View File

@@ -1,19 +0,0 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import lombok.Data;
@Data
public class SipSendFailEvent extends SipSubscribe.EventResult<String> {
private String callId;
private String msg;
public static SipSendFailEvent getInstance(String callId, String msg){
SipSendFailEvent sipSendFailEvent = new SipSendFailEvent();
sipSendFailEvent.setMsg(msg);
sipSendFailEvent.setCallId(callId);
return sipSendFailEvent;
}
}

View File

@@ -1,7 +1,6 @@
package com.genersoft.iot.vmp.gb28181.event;
import com.genersoft.iot.vmp.gb28181.bean.DeviceNotFoundEvent;
import com.genersoft.iot.vmp.gb28181.bean.SipSendFailEvent;
import com.genersoft.iot.vmp.gb28181.event.sip.SipEvent;
import gov.nist.javax.sip.message.SIPRequest;
import gov.nist.javax.sip.message.SIPResponse;
@@ -150,12 +149,6 @@ public class SipSubscribe {
this.msg = "设备未找到";
this.statusCode = -1024;
this.callId = ((DeviceNotFoundEvent) event).getCallId();
}else if (event instanceof SipSendFailEvent) {
SipSendFailEvent sipSendFailEvent = (SipSendFailEvent) event;
this.type = EventResultType.deviceNotFoundEvent;
this.msg = sipSendFailEvent.getMsg();
this.statusCode = -1024;
this.callId = ((SipSendFailEvent) event).getCallId();
}
}
}

View File

@@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.gb28181.transmit;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.SipLayer;
import com.genersoft.iot.vmp.gb28181.bean.SipSendFailEvent;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.event.sip.SipEvent;
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
@@ -13,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import javax.sip.ResponseEvent;
import javax.sip.SipException;
import javax.sip.header.CSeqHeader;
import javax.sip.header.CallIdHeader;
@@ -115,14 +113,9 @@ public class SIPSender {
}
}
}catch (SipException e) {
log.error("[发送信息失败] ", e);
SipSendFailEvent sipSendFailEvent = SipSendFailEvent.getInstance(callIdHeader.getCallId(), e.getMessage());
SipSubscribe.EventResult<SipSendFailEvent> eventResult = new SipSubscribe.EventResult<>(sipSendFailEvent);
SipEvent subscribe = sipSubscribe.getSubscribe(key);
subscribe.getErrorEvent().response(eventResult);
sipSubscribe.removeSubscribe(key);
throw e;
}
}
public CallIdHeader getNewCallIdHeader(String ip, String transport) {