修复cseq序号回退

This commit is contained in:
648540858 2022-09-08 15:27:47 +08:00
parent ce40fd9a88
commit 75987dd8fe
3 changed files with 16 additions and 7 deletions

View File

@ -74,7 +74,7 @@ public class SIPRequestHeaderProvider {
// Forwards
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
// ceq
CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(1L, Request.MESSAGE);
CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.MESSAGE);
request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
@ -178,7 +178,7 @@ public class SIPRequestHeaderProvider {
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
//ceq
CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(1L, Request.BYE);
CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.BYE);
CallIdHeader callIdHeader = sipFactory.createHeaderFactory().createCallIdHeader(callId);
request = sipFactory.createMessageFactory().createRequest(requestLine, Request.BYE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);

View File

@ -1899,7 +1899,7 @@ public class SIPCommander implements ISIPCommander {
private void sendNotify(Device device, String catalogXmlContent,
SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent )
throws NoSuchFieldException, IllegalAccessException, SipException, ParseException {
throws SipException, ParseException {
MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory();
String characterSet = device.getCharset();
// 设置编码 防止中文乱码

View File

@ -436,6 +436,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvalidArgumentException e) {
e.printStackTrace();
}
return true;
}
@ -477,7 +479,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
e.printStackTrace();
return false;
} catch (InvalidArgumentException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
return true;
}
@ -516,13 +518,15 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvalidArgumentException e) {
e.printStackTrace();
}
return true;
}
private void sendNotify(ParentPlatform parentPlatform, String catalogXmlContent,
SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent )
throws NoSuchFieldException, IllegalAccessException, SipException, ParseException {
throws NoSuchFieldException, IllegalAccessException, SipException, ParseException, InvalidArgumentException {
MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory();
String characterSet = parentPlatform.getCharacterSet();
// 设置编码 防止中文乱码
@ -532,6 +536,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
return;
}
SIPRequest notifyRequest = (SIPRequest)dialog.createRequest(Request.NOTIFY);
notifyRequest.getCSeqHeader().setSeqNumber(redisCatchStorage.getCSEQ());
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
notifyRequest.setContent(catalogXmlContent, contentTypeHeader);
@ -664,6 +671,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvalidArgumentException e) {
e.printStackTrace();
}
return true;
@ -818,9 +827,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
e.printStackTrace();
return false;
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
e.printStackTrace();
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
return true;