Browse Source

使用getHostAddress代替getHostName避免经过DNS时间过久

pull/426/head
648540858 3 years ago
parent
commit
4ac63a158d
  1. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
  2. 4
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java

2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@ -725,7 +725,7 @@ public class SIPCommander implements ISIPCommander {
Request byeRequest = dialog.createRequest(Request.BYE); Request byeRequest = dialog.createRequest(Request.BYE);
SipURI byeURI = (SipURI) byeRequest.getRequestURI(); SipURI byeURI = (SipURI) byeRequest.getRequestURI();
SIPRequest request = (SIPRequest)transaction.getRequest(); SIPRequest request = (SIPRequest)transaction.getRequest();
byeURI.setHost(request.getRemoteAddress().getHostName()); byeURI.setHost(request.getRemoteAddress().getHostAddress());
byeURI.setPort(request.getRemotePort()); byeURI.setPort(request.getRemotePort());
ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME); ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME);
String protocol = viaHeader.getTransport().toUpperCase(); String protocol = viaHeader.getTransport().toUpperCase();

4
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java

@ -442,7 +442,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
SipURI sipURI = (SipURI) notifyRequest.getRequestURI(); SipURI sipURI = (SipURI) notifyRequest.getRequestURI();
SIPRequest request = (SIPRequest) subscribeInfo.getTransaction().getRequest(); SIPRequest request = (SIPRequest) subscribeInfo.getTransaction().getRequest();
sipURI.setHost(request.getRemoteAddress().getHostName()); sipURI.setHost(request.getRemoteAddress().getHostAddress());
sipURI.setPort(request.getRemotePort()); sipURI.setPort(request.getRemotePort());
ClientTransaction transaction = null; ClientTransaction transaction = null;
if ("TCP".equals(parentPlatform.getTransport())) { if ("TCP".equals(parentPlatform.getTransport())) {
@ -653,7 +653,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
SipURI byeURI = (SipURI) byeRequest.getRequestURI(); SipURI byeURI = (SipURI) byeRequest.getRequestURI();
SIPRequest request = (SIPRequest) clientTransaction.getRequest(); SIPRequest request = (SIPRequest) clientTransaction.getRequest();
byeURI.setHost(request.getRemoteAddress().getHostName()); byeURI.setHost(request.getRemoteAddress().getHostAddress());
byeURI.setPort(request.getRemotePort()); byeURI.setPort(request.getRemotePort());
if ("TCP".equals(platform.getTransport())) { if ("TCP".equals(platform.getTransport())) {
clientTransaction = tcpSipProvider.getNewClientTransaction(byeRequest); clientTransaction = tcpSipProvider.getNewClientTransaction(byeRequest);

Loading…
Cancel
Save