code: public EventObject waitResponse(SipTransaction trans, long timeout) {
      EventObject event = phone.waitResponse(trans, timeout);
  
      if (event instanceof ResponseEvent) {
        receivedResponses.add(new SipResponse((ResponseEvent) event));
      }
  
      return event;
    }
docs: The waitResponse() method waits for a response to a previously sent transactional request
  message. Call this method after calling sendStatefulNotify().
  
  <p>
  This method blocks until one of the following occurs: 1) A javax.sip.ResponseEvent is received.
  This is the object returned by this method. 2) A javax.sip.TimeoutEvent is received. This is
  the object returned by this method. 3) The wait timeout period specified by the parameter to
  this method expires. Null is returned in this case. 4) An error occurs. Null is returned in
  this case.
  
  <p>
  Note that this method can be called repeatedly upon receipt of provisional response message(s).
  
  @param trans The SipTransaction object associated with the sent request. This is the object
  returned by sendStatefulNotify().
  @param timeout The maximum amount of time to wait, in milliseconds. Use a value of 0 to wait
  indefinitely.
  @return A javax.sip.ResponseEvent, javax.sip.TimeoutEvent, or null in the case of wait timeout
  or error. If null, call getReturnCode() and/or getErrorMessage() and, if applicable,
  getException() for further diagnostics.