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