null);
// get Request URI
SipURI requestURI = (SipURI) to.getAddress().getURI();
ListeningPoint lp = mySipProvider.getListeningPoint(transport);
// Create ViaHeaders
ArrayList viaHeaders = new ArrayList();
ViaHeader viaHeader = headerFactory.createViaHeader("127.0.0.1",
lp.getPort(), transport, null);
// add via headers
viaHeaders.add(viaHeader);
// Create a new CallId header
CallIdHeader callIdHeader = mySipProvider.getNewCallId();
// JvB: Make sure that the implementation matches the messagefactory
callIdHeader = headerFactory.createCallIdHeader( callIdHeader.getCallId() );
// Create a new Cseq header
CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1L,
Request.INVITE);
// Create a new MaxForwardsHeader
MaxForwardsHeader maxForwards = headerFactory
.createMaxForwardsHeader(70);
// Create the request. (TODO should read request type from Refer-To)
Request request = messageFactory.createRequest(requestURI,
Request.INVITE, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
// Create contact headers
String host = lp.getIPAddress();
SipURI contactURI = addressFactory.createSipURI(fromName, host);
contactURI.setPort(lp.getPort());
contactURI.setTransportParam( transport );
Address contactAddress = addressFactory.createAddress(contactURI);
// Add the contact address.