修复消息超时未回复误报
This commit is contained in:
@@ -97,10 +97,12 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||
CallIdHeader callIdHeader = response.getCallIdHeader();
|
||||
if (callIdHeader != null) {
|
||||
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId());
|
||||
if (sipEvent != null && sipEvent.getOkEvent() != null) {
|
||||
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
|
||||
if (sipEvent != null) {
|
||||
if (sipEvent.getOkEvent() != null) {
|
||||
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
|
||||
sipEvent.getOkEvent().response(eventResult);
|
||||
}
|
||||
sipSubscribe.removeSubscribe(callIdHeader.getCallId());
|
||||
sipEvent.getOkEvent().response(eventResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,10 +120,12 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||
CallIdHeader callIdHeader = (CallIdHeader)responseEvent.getResponse().getHeader(CallIdHeader.NAME);
|
||||
if (callIdHeader != null) {
|
||||
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId());
|
||||
if (sipEvent != null && sipEvent.getErrorEvent() != null) {
|
||||
SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent);
|
||||
if (sipEvent != null ) {
|
||||
if (sipEvent.getErrorEvent() != null) {
|
||||
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
|
||||
sipEvent.getErrorEvent().response(eventResult);
|
||||
}
|
||||
sipSubscribe.removeSubscribe(callIdHeader.getCallId());
|
||||
sipEvent.getErrorEvent().response(eventResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,17 +72,18 @@ public class SIPSender {
|
||||
if (okEvent != null || errorEvent != null) {
|
||||
CallIdHeader callIdHeader = (CallIdHeader) message.getHeader(CallIdHeader.NAME);
|
||||
SipEvent sipEvent = SipEvent.getInstance(callIdHeader.getCallId(), eventResult -> {
|
||||
sipSubscribe.removeSubscribe(eventResult.callId);
|
||||
sipSubscribe.removeSubscribe(callIdHeader.getCallId());
|
||||
if(okEvent != null) {
|
||||
okEvent.response(eventResult);
|
||||
}
|
||||
}, (eventResult -> {
|
||||
sipSubscribe.removeSubscribe(eventResult.callId);
|
||||
sipSubscribe.removeSubscribe(callIdHeader.getCallId());
|
||||
if (errorEvent != null) {
|
||||
errorEvent.response(eventResult);
|
||||
}
|
||||
}), timeout == null ? sipConfig.getTimeout() : timeout);
|
||||
sipSubscribe.addSubscribe(callIdHeader.getCallId(), sipEvent);
|
||||
System.out.println("订阅数量" + sipSubscribe.size());
|
||||
}
|
||||
|
||||
if ("TCP".equals(transport)) {
|
||||
|
||||
Reference in New Issue
Block a user