mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 14:07:50 +08:00
Compare commits
1 Commits
f93ab65fff
...
6edf3dd98b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6edf3dd98b |
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user