Compare commits

..

1 Commits

Author SHA1 Message Date
阿斌
8cfa5902be
Pre Merge pull request !36 from 阿斌/N/A 2025-05-12 09:29:58 +00:00
3 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,19 @@
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,6 +1,7 @@
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;
@ -149,6 +150,12 @@ 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,6 +2,7 @@ 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;
@ -12,6 +13,7 @@ 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;
@ -113,9 +115,14 @@ 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) {