Commit 4bda14b098bc943324c73a8365c8bcd721beaa5a
1 parent
a6f9c090
修复cseq序号回退
Showing
3 changed files
with
16 additions
and
7 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
| @@ -74,7 +74,7 @@ public class SIPRequestHeaderProvider { | @@ -74,7 +74,7 @@ public class SIPRequestHeaderProvider { | ||
| 74 | // Forwards | 74 | // Forwards |
| 75 | MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70); | 75 | MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70); |
| 76 | // ceq | 76 | // ceq |
| 77 | - CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(1L, Request.MESSAGE); | 77 | + CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.MESSAGE); |
| 78 | 78 | ||
| 79 | request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, | 79 | request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, |
| 80 | toHeader, viaHeaders, maxForwards); | 80 | toHeader, viaHeaders, maxForwards); |
| @@ -178,7 +178,7 @@ public class SIPRequestHeaderProvider { | @@ -178,7 +178,7 @@ public class SIPRequestHeaderProvider { | ||
| 178 | MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70); | 178 | MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70); |
| 179 | 179 | ||
| 180 | //ceq | 180 | //ceq |
| 181 | - CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(1L, Request.BYE); | 181 | + CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.BYE); |
| 182 | CallIdHeader callIdHeader = sipFactory.createHeaderFactory().createCallIdHeader(callId); | 182 | CallIdHeader callIdHeader = sipFactory.createHeaderFactory().createCallIdHeader(callId); |
| 183 | request = sipFactory.createMessageFactory().createRequest(requestLine, Request.BYE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards); | 183 | request = sipFactory.createMessageFactory().createRequest(requestLine, Request.BYE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards); |
| 184 | 184 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -1899,7 +1899,7 @@ public class SIPCommander implements ISIPCommander { | @@ -1899,7 +1899,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 1899 | 1899 | ||
| 1900 | private void sendNotify(Device device, String catalogXmlContent, | 1900 | private void sendNotify(Device device, String catalogXmlContent, |
| 1901 | SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent ) | 1901 | SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent ) |
| 1902 | - throws NoSuchFieldException, IllegalAccessException, SipException, ParseException { | 1902 | + throws SipException, ParseException { |
| 1903 | MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); | 1903 | MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); |
| 1904 | String characterSet = device.getCharset(); | 1904 | String characterSet = device.getCharset(); |
| 1905 | // 设置编码, 防止中文乱码 | 1905 | // 设置编码, 防止中文乱码 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| @@ -436,6 +436,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -436,6 +436,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 436 | e.printStackTrace(); | 436 | e.printStackTrace(); |
| 437 | } catch (IllegalAccessException e) { | 437 | } catch (IllegalAccessException e) { |
| 438 | e.printStackTrace(); | 438 | e.printStackTrace(); |
| 439 | + } catch (InvalidArgumentException e) { | ||
| 440 | + e.printStackTrace(); | ||
| 439 | } | 441 | } |
| 440 | return true; | 442 | return true; |
| 441 | } | 443 | } |
| @@ -477,7 +479,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -477,7 +479,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 477 | e.printStackTrace(); | 479 | e.printStackTrace(); |
| 478 | return false; | 480 | return false; |
| 479 | } catch (InvalidArgumentException e) { | 481 | } catch (InvalidArgumentException e) { |
| 480 | - throw new RuntimeException(e); | 482 | + e.printStackTrace(); |
| 481 | } | 483 | } |
| 482 | return true; | 484 | return true; |
| 483 | } | 485 | } |
| @@ -516,13 +518,15 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -516,13 +518,15 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 516 | e.printStackTrace(); | 518 | e.printStackTrace(); |
| 517 | } catch (IllegalAccessException e) { | 519 | } catch (IllegalAccessException e) { |
| 518 | e.printStackTrace(); | 520 | e.printStackTrace(); |
| 521 | + } catch (InvalidArgumentException e) { | ||
| 522 | + e.printStackTrace(); | ||
| 519 | } | 523 | } |
| 520 | return true; | 524 | return true; |
| 521 | } | 525 | } |
| 522 | 526 | ||
| 523 | private void sendNotify(ParentPlatform parentPlatform, String catalogXmlContent, | 527 | private void sendNotify(ParentPlatform parentPlatform, String catalogXmlContent, |
| 524 | SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent ) | 528 | SubscribeInfo subscribeInfo, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent ) |
| 525 | - throws NoSuchFieldException, IllegalAccessException, SipException, ParseException { | 529 | + throws NoSuchFieldException, IllegalAccessException, SipException, ParseException, InvalidArgumentException { |
| 526 | MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); | 530 | MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); |
| 527 | String characterSet = parentPlatform.getCharacterSet(); | 531 | String characterSet = parentPlatform.getCharacterSet(); |
| 528 | // 设置编码, 防止中文乱码 | 532 | // 设置编码, 防止中文乱码 |
| @@ -532,6 +536,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -532,6 +536,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 532 | return; | 536 | return; |
| 533 | } | 537 | } |
| 534 | SIPRequest notifyRequest = (SIPRequest)dialog.createRequest(Request.NOTIFY); | 538 | SIPRequest notifyRequest = (SIPRequest)dialog.createRequest(Request.NOTIFY); |
| 539 | + | ||
| 540 | + notifyRequest.getCSeqHeader().setSeqNumber(redisCatchStorage.getCSEQ()); | ||
| 541 | + | ||
| 535 | ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); | 542 | ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); |
| 536 | notifyRequest.setContent(catalogXmlContent, contentTypeHeader); | 543 | notifyRequest.setContent(catalogXmlContent, contentTypeHeader); |
| 537 | 544 | ||
| @@ -664,6 +671,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -664,6 +671,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 664 | e.printStackTrace(); | 671 | e.printStackTrace(); |
| 665 | } catch (IllegalAccessException e) { | 672 | } catch (IllegalAccessException e) { |
| 666 | e.printStackTrace(); | 673 | e.printStackTrace(); |
| 674 | + } catch (InvalidArgumentException e) { | ||
| 675 | + e.printStackTrace(); | ||
| 667 | } | 676 | } |
| 668 | 677 | ||
| 669 | return true; | 678 | return true; |
| @@ -818,9 +827,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -818,9 +827,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 818 | e.printStackTrace(); | 827 | e.printStackTrace(); |
| 819 | return false; | 828 | return false; |
| 820 | } catch (NoSuchFieldException e) { | 829 | } catch (NoSuchFieldException e) { |
| 821 | - throw new RuntimeException(e); | 830 | + e.printStackTrace(); |
| 822 | } catch (IllegalAccessException e) { | 831 | } catch (IllegalAccessException e) { |
| 823 | - throw new RuntimeException(e); | 832 | + e.printStackTrace(); |
| 824 | } | 833 | } |
| 825 | return true; | 834 | return true; |
| 826 | 835 |