if (reInviteCount == 0) { Request inviteRequest = dialog.createRequest(Request.INVITE); ((SipURI)inviteRequest.getRequestURI()).removeParameter("transport"); ((ViaHeader)inviteRequest.getHeader(ViaHeader.NAME)).setTransport("tls"); inviteRequest.addHeader(contactHeader); try {Thread.sleep(100); } catch (Exception ex) {} ClientTransaction ct = tlsProvider.getNewClientTransaction(inviteRequest); dialog.sendRequest(ct); reInviteCount ++; }
	public void processResponse(ResponseEvent responseReceivedEvent) {		System.out.println("Got a response");		Response response = (Response) responseReceivedEvent.getResponse();		Transaction tid = responseReceivedEvent.getClientTransaction();		System.out.println(			"Response received with client transaction id "				+ tid				+ ":\n"				+ response.getStatusCode());		if (tid == null) {			System.out.println("Stray response -- dropping ");			return;		}		System.out.println("transaction state is " + tid.getState());		System.out.println("Dialog = " + tid.getDialog());		System.out.println("Dialog State is " + tid.getDialog().getState());		try {			if (response.getStatusCode() == Response.OK				&& ((CSeqHeader) response.getHeader(CSeqHeader.NAME))					.getMethod()					.equals(					Request.INVITE)) {				// Request cancel = inviteTid.createCancel();				// ClientTransaction ct = 				//	sipProvider.getNewClientTransaction(cancel);				// ct.sendRequest();				Dialog dialog = tid.getDialog();				Request ackRequest = dialog.createRequest(Request.ACK);				System.out.println("Sending ACK");				dialog.sendAck(ackRequest);			}		} catch (Exception ex) {			ex.printStackTrace();			System.exit(0);		}	}