protected Request createRequest(String method,AddressFactory addressFactory,HeaderFactory headerFactory,MessageFactory messageFactory,SipProvider srcProvider,SipProvider dstProvider,String contentType,String contentSubType,Object content) throws Exception {
  ListeningPoint srclp=srcProvider.getListeningPoints()[0];
  SipURI srcSipURI=addressFactory.createSipURI(null,srclp.getIPAddress());
  srcSipURI.setPort(srclp.getPort());
  srcSipURI.setTransportParam(srclp.getTransport());
  ListeningPoint dstlp=dstProvider.getListeningPoints()[0];
  SipURI dstSipURI=addressFactory.createSipURI(null,dstlp.getIPAddress());
  dstSipURI.setPort(dstlp.getPort());
  dstSipURI.setTransportParam(dstlp.getTransport());
  CallIdHeader callId=srcProvider.getNewCallId();
  callId=headerFactory.createCallIdHeader(callId.getCallId());
  CSeqHeader cSeq=headerFactory.createCSeqHeader(1L,method);
  Address fromAddress=addressFactory.createAddress(srcSipURI);
  FromHeader from=headerFactory.createFromHeader(fromAddress,Integer.toString(srcProvider.hashCode()));
  Address toAddress=addressFactory.createAddress(dstSipURI);
  ToHeader to=headerFactory.createToHeader(toAddress,null);
  ContactHeader contact=headerFactory.createContactHeader(fromAddress);
  List via=new LinkedList();
  ViaHeader viaHeader=headerFactory.createViaHeader(srclp.getIPAddress(),srclp.getPort(),srclp.getTransport(),"z9hG4bK" + Long.toString(System.currentTimeMillis()));
  via.add(viaHeader);
  MaxForwardsHeader maxForwards=headerFactory.createMaxForwardsHeader(3);
  Request request=messageFactory.createRequest(dstSipURI,method,callId,cSeq,from,to,via,maxForwards);
  request.addHeader(contact);
  if (contentType != null && contentSubType != null && content != null) {
    ContentTypeHeader contentTypeHdr=headerFactory.createContentTypeHeader(contentType,contentSubType);
    request.setContent(content,contentTypeHdr);
  }
  addStatus(headerFactory,request);
  return request;
}

protected Request createRequest ( String method , AddressFactory addressFactory , HeaderFactory headerFactory , MessageFactory messageFactory , SipProvider srcProvider , SipProvider dstProvider , String contentType , String contentSubType , Object content ) throws Exception { ListeningPoint srclp = srcProvider . getListeningPoints ( ) [ 0 ] ; SipURI srcSipURI = addressFactory . createSipURI ( null , srclp . getIPAddress ( ) ) ; srcSipURI . setPort ( srclp . getPort ( ) ) ; srcSipURI . setTransportParam ( srclp . getTransport ( ) ) ; ListeningPoint dstlp = dstProvider . getListeningPoints ( ) [ 0 ] ; SipURI dstSipURI = addressFactory . createSipURI ( null , dstlp . getIPAddress ( ) ) ; dstSipURI . setPort ( dstlp . getPort ( ) ) ; dstSipURI . setTransportParam ( dstlp . getTransport ( ) ) ; CallIdHeader callId = srcProvider . getNewCallId ( ) ; callId = headerFactory . createCallIdHeader ( callId . getCallId ( ) ) ; CSeqHeader cSeq = headerFactory . createCSeqHeader ( 1L , method ) ; Address fromAddress = addressFactory . createAddress ( srcSipURI ) ; FromHeader from = headerFactory . createFromHeader ( fromAddress , Integer . toString ( srcProvider . hashCode ( ) ) ) ; Address toAddress = addressFactory . createAddress ( dstSipURI ) ; ToHeader to = headerFactory . createToHeader ( toAddress , null ) ; ContactHeader contact = headerFactory . createContactHeader ( fromAddress ) ; List via = new LinkedList ( ) ; ViaHeader viaHeader = headerFactory . createViaHeader ( srclp . getIPAddress ( ) , srclp . getPort ( ) , srclp . getTransport ( ) , "z9hG4bK" + Long . toString ( System . currentTimeMillis ( ) ) ) ; via . add ( viaHeader ) ; MaxForwardsHeader maxForwards = headerFactory . createMaxForwardsHeader ( 3 ) ; Request request = messageFactory . createRequest ( dstSipURI , method , callId , cSeq , from , to , via , maxForwards ) ; request . addHeader ( contact ) ; if ( contentType != null && contentSubType != null && content != null ) { ContentTypeHeader contentTypeHdr = headerFactory . createContentTypeHeader ( contentType , contentSubType ) ; request . setContent ( content , contentTypeHdr ) ; } addStatus ( headerFactory , request ) ; return request ; }
creates a siprequest using the specified factories . the request has the specified method and is meant to be sent from srcprovider to dstprovider . this method is prefered to manual creation of requests as it helps avoid using ri objects instead of corresponding ti objects ( or vice versa ) .
