|  |  | 
 |  |  | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 
 |  |  | import gov.nist.javax.sip.message.MessageFactoryImpl; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | // import org.springframework.beans.factory.annotation.Qualifier; | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  | import org.springframework.util.DigestUtils; | 
 |  |  |  | 
 |  |  | 
 |  |  |     | 
 |  |  |    @Autowired | 
 |  |  |    private SipFactory sipFactory; | 
 |  |  | 	 | 
 |  |  | //   @Autowired | 
 |  |  | //   @Qualifier(value="tcpSipProvider") | 
 |  |  | //   private SipProvider tcpSipProvider; | 
 |  |  | // | 
 |  |  | //   @Autowired | 
 |  |  | //   @Qualifier(value="udpSipProvider") | 
 |  |  | //   private SipProvider udpSipProvider; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |    public Request createKeetpaliveMessageRequest(ParentPlatform parentPlatform, String content, String viaTag, String fromTag, String toTag, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException { | 
 |  |  | 
 |  |  |       Request request = null; | 
 |  |  |       String sipAddress = sipConfig.getSipIp() + ":" + sipConfig.getSipPort(); | 
 |  |  |       //请求行 | 
 |  |  |       SipURI requestLine = sipFactory.createAddressFactory().createSipURI(platform.getDeviceGBId(), | 
 |  |  |       SipURI requestLine = sipFactory.createAddressFactory().createSipURI(platform.getServerGBId(), | 
 |  |  |             platform.getServerIP() + ":" + platform.getServerPort()); | 
 |  |  |       //via | 
 |  |  |       ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>(); | 
 |  |  | 
 |  |  |       viaHeader.setRPort(); | 
 |  |  |       viaHeaders.add(viaHeader); | 
 |  |  |       // from | 
 |  |  |       SipURI fromSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), | 
 |  |  |       SipURI fromSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getDeviceGBId(), | 
 |  |  |             parentPlatform.getDeviceIp() + ":" + parentPlatform.getDevicePort()); | 
 |  |  |       Address fromAddress = sipFactory.createAddressFactory().createAddress(fromSipURI); | 
 |  |  |       FromHeader fromHeader = sipFactory.createHeaderFactory().createFromHeader(fromAddress, fromTag); | 
 |  |  |       // to | 
 |  |  |       SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getDeviceGBId(), parentPlatform.getServerGBDomain()); | 
 |  |  |       SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerGBDomain()); | 
 |  |  |       Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI); | 
 |  |  |       ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress, null); | 
 |  |  |  |