public ReferSubscriber refer(String refereeUri, SipURI referToUri, String eventId, long timeout,
      String viaNonProxyRoute, ArrayList<Header> additionalHeaders,
      ArrayList<Header> replaceHeaders, String body) {
    initErrorInfo();

    if (referToUri == null) {
      setReturnCode(INVALID_ARGUMENT);
      setErrorMessage("Null referToUri");
      return null;
    }

    ReferSubscriber sub = null;
    try {
      sub = new ReferSubscriber(refereeUri, referToUri, this);
      Request req = sub.createReferMessage(referToUri, eventId, viaNonProxyRoute);

      if (req != null) {
        synchronized (refererList) {
          refererList.add(sub);
        }

        boolean viaProxy = (proxyHost != null) && (viaNonProxyRoute == null);

        if (sub.startSubscription(req, timeout, viaProxy, additionalHeaders, replaceHeaders,
            body) == true) {
          return sub;
        }
      }

      setReturnCode(sub.getReturnCode());
      setErrorMessage(sub.getErrorMessage());
      setException(sub.getException());
    } catch (Exception e) {
      setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
      setException(e);
      setErrorMessage("Exception: " + e.getClass().getName() + ": " + e.getMessage());
    }

    if (sub != null) {
      synchronized (refererList) {
        refererList.remove(sub);
      }
    }

    return null;
  }
public ReferSubscriber refer ( String refereeUri , SipURI referToUri , String eventId , long timeout , String viaNonProxyRoute , ArrayList < Header > additionalHeaders , ArrayList < Header > replaceHeaders , String body ) { initErrorInfo ( ) ; if ( referToUri == null ) { setReturnCode ( INVALID_ARGUMENT ) ; setErrorMessage ( "Null referToUri" ) ; return null ; } ReferSubscriber sub = null ; try { sub = new ReferSubscriber ( refereeUri , referToUri , this ) ; Request req = sub . createReferMessage ( referToUri , eventId , viaNonProxyRoute ) ; if ( req != null ) { synchronized ( refererList ) { refererList . add ( sub ) ; } boolean viaProxy = ( proxyHost != null ) && ( viaNonProxyRoute == null ) ; if ( sub . startSubscription ( req , timeout , viaProxy , additionalHeaders , replaceHeaders , body ) == true ) { return sub ; } } setReturnCode ( sub . getReturnCode ( ) ) ; setErrorMessage ( sub . getErrorMessage ( ) ) ; setException ( sub . getException ( ) ) ; } catch ( Exception e ) { setReturnCode ( SipSession . EXCEPTION_ENCOUNTERED ) ; setException ( e ) ; setErrorMessage ( "Exception: " + e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; } if ( sub != null ) { synchronized ( refererList ) { refererList . remove ( sub ) ; } } return null ; }
This method is the same as the basic out-of-dialog refer() method except that it allows the
caller to specify a message body and/or additional JAIN-SIP API message headers to add to or
replace in the outbound message. Use of this method requires knowledge of the JAIN-SIP API.

<p>
The extra parameters supported by this method are:

@param additionalHeaders ArrayList of javax.sip.header.Header, each element a SIP header to add
to the outbound message. These headers are added to the message after a correct message
has been constructed. Note that if you try to add a header that there is only supposed
to be one of in a message, and it's already there and only one single value is allowed
for that header, then this header addition attempt will be ignored. Use the
'replaceHeaders' parameter instead if you want to replace the existing header with your
own. Use null for no additional message headers.
@param replaceHeaders ArrayList of javax.sip.header.Header, each element a SIP header to add to
the outbound message, replacing existing header(s) of that type if present in the
message. These headers are applied to the message after a correct message has been
constructed. Use null for no replacement of message headers.
@param body A String to be used as the body of the message. The additionalHeaders parameter
must contain a ContentTypeHeader for this body to be included in the message. Use null
for no body bytes.