|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.cafesip.sipunit.SipSession
public class SipSession
Methods of this class provide the test program with low-level access to a SIP session. Instead of using the SipPhone methods to communicate with other SIP agents, the test program can use methods of this class to send and receive SIP messages. Methods of this class can be accessed via the SipPhone object returned by SipStack.createSipPhone().
Many of the methods in this class return an object or true return value if successful. In case of an error or caller-specified timeout, a null object or a false is returned. The getErrorMessage(), getReturnCode() and getException() methods may be used for further diagnostics. The getReturnCode() method returns either the SIP response code received from the network (defined in SipResponse) or a SipUnit internal status/return code (defined in SipSession). SipUnit internal codes are in a specially designated range (SipSession.SIPUNIT_INTERNAL_RETURNCODE_MIN and upward). The information provided by the getException() method is only meaningful when the getReturnCode() method returns internal SipUnit return code EXCEPTION_ENCOUNTERED. The getErrorMessage() method returns a descriptive string indicating the cause of the problem. If an exception was involved, this string will contain the name of the Exception class and the exception message. This class has a method, format(), which can be called to obtain a human-readable string containing all of this error information.
| Field Summary | |
|---|---|
static int |
ERROR_OF_UNKNOWN_ORIGIN
|
static int |
EXCEPTION_ENCOUNTERED
|
static int |
FAR_END_ERROR
|
static int |
INTERNAL_ERROR
|
static int |
INVALID_ARGUMENT
|
static int |
INVALID_OPERATION
|
static int |
INVALID_UNREGISTERED_OPERATION
|
static int |
MAX_FORWARDS_DEFAULT
|
static int |
MISSING_CREDENTIAL
|
static int |
NONE_YET
|
static int |
SIPUNIT_INTERNAL_RETURNCODE_MIN
Comment for SIPUNIT_INTERNAL_RETURNCODE_MIN A constant
marking the lowest possible SipUnit internal return code value. |
static java.util.HashMap<java.lang.Integer,java.lang.String> |
statusCodeDescription
Comment for statusCodeDescription This map yields a
descriptive string, given an internal sipunit return code. |
static int |
TIMEOUT_OCCURRED
|
static int |
UNSUPPORTED_URI_SCHEME
|
| Method Summary | |
|---|---|
void |
dispose()
This method idles this SipSession. |
java.lang.String |
format()
The format() method can be used to obtain a human-readable string containing the result of the last operation - either a successful indication or all of the error information associated with the last operation performed. |
java.lang.String |
generateNewTag()
This method returns a newly generated unique tag ID. |
javax.sip.header.AuthorizationHeader |
getAuthorization(java.lang.String method,
java.lang.String uri,
java.lang.String requestBody,
javax.sip.header.WWWAuthenticateHeader authHeader,
java.lang.String username,
java.lang.String password)
The getAuthorization() method generates an authorisation header in response to an authentication challenge. |
java.lang.String |
getErrorMessage()
The getErrorMessage() method returns a descriptive, human-readable string indicating the cause of the problem encountered during the last operation performed. |
java.lang.Throwable |
getException()
This method is used to get the Exception object generated during the last operation performed. |
java.util.ArrayList<javax.sip.header.ViaHeader> |
getLocalViaHeaders()
Deprecated. Use getViaHeaders() instead of this method, the term 'local' in the method name is misleading if the SipUnit test is running behind a NAT. |
SipStack |
getParent()
The getParent() method returns the org.cafesip.sipunit.SipStack object that is associated with this SipSession object. |
java.lang.String |
getPublicAddress()
This method returns the IP address and port currently being used in this Sip agent's contact address, via, and listening point 'sentby' components. |
int |
getReturnCode()
This method returns the status code of the current or last operation performed. |
java.lang.String |
getStackAddress()
Call this method to get the IP address being used by this user agent (ie, the address it is putting in its contact header, via header, etc. |
java.util.ArrayList<javax.sip.header.ViaHeader> |
getViaHeaders()
This method returns the Via Header currently in effect for this user agent, needed for sending requests such as INVITE. |
static boolean |
isInternal(int returnCode)
This method indicates if the given return code is an internal SipUnit return code or not. |
boolean |
listenRequestMessage()
This method prepares the SipSession for reception of a request message addressed to this SipSession's URI. |
void |
processDialogTerminated(javax.sip.DialogTerminatedEvent arg0)
|
void |
processIOException(javax.sip.IOExceptionEvent arg0)
|
void |
processRequest(javax.sip.RequestEvent request)
FOR INTERNAL USE ONLY. |
void |
processResponse(javax.sip.ResponseEvent response)
FOR INTERNAL USE ONLY. |
void |
processTimeout(javax.sip.TimeoutEvent timeout)
FOR INTERNAL USE ONLY. |
void |
processTransactionTerminated(javax.sip.TransactionTerminatedEvent arg0)
|
SipTransaction |
sendReply(javax.sip.RequestEvent request,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires)
This method sends a basic, stateful response to a previously received request. |
SipTransaction |
sendReply(javax.sip.RequestEvent request,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires,
java.util.ArrayList<javax.sip.header.Header> additionalHeaders,
java.util.ArrayList<javax.sip.header.Header> replaceHeaders,
java.lang.String body)
This method is the same as the basic sendReply(RequestEvent, ...) 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. |
SipTransaction |
sendReply(javax.sip.RequestEvent request,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires,
java.lang.String body,
java.lang.String contentType,
java.lang.String contentSubType,
java.util.ArrayList<java.lang.String> additionalHeaders,
java.util.ArrayList<java.lang.String> replaceHeaders)
This method is the same as the basic sendReply(RequestEvent, ...) method except that it allows the caller to specify a message body and/or additional message headers to add to or replace in the outbound message, without requiring knowledge of the JAIN-SIP API. |
SipTransaction |
sendReply(javax.sip.RequestEvent request,
javax.sip.message.Response response)
This method sends a stateful response to a previously received request. |
SipTransaction |
sendReply(SipTransaction transaction,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires)
This method sends a basic, stateful response to a previously received request. |
SipTransaction |
sendReply(SipTransaction transaction,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires,
java.util.ArrayList<javax.sip.header.Header> additionalHeaders,
java.util.ArrayList<javax.sip.header.Header> replaceHeaders,
java.lang.String body)
This method is the same as the basic sendReply(SipTransaction, ...) 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. |
SipTransaction |
sendReply(SipTransaction transaction,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires,
java.lang.String body,
java.lang.String contentType,
java.lang.String contentSubType,
java.util.ArrayList<java.lang.String> additionalHeaders,
java.util.ArrayList<java.lang.String> replaceHeaders)
This method is the same as the basic sendReply(SipTransaction, ...) method except that it allows the caller to specify a message body and/or additional message headers to add to or replace in the outbound message, without requiring knowledge of the JAIN-SIP API. |
SipTransaction |
sendReply(SipTransaction transaction,
javax.sip.message.Response response)
This method sends a stateful response to a previously received request. |
SipTransaction |
sendRequestWithTransaction(javax.sip.message.Request request,
boolean viaProxy,
javax.sip.Dialog dialog)
This basic method sends out a request message as part of a transaction. |
SipTransaction |
sendRequestWithTransaction(javax.sip.message.Request request,
boolean viaProxy,
javax.sip.Dialog dialog,
java.util.ArrayList<javax.sip.header.Header> additionalHeaders,
java.util.ArrayList<javax.sip.header.Header> replaceHeaders,
java.lang.String body)
This method is the same as the basic sendRequestWithTransaction(Request,...) 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. |
SipTransaction |
sendRequestWithTransaction(javax.sip.message.Request request,
boolean viaProxy,
javax.sip.Dialog dialog,
java.lang.String body,
java.lang.String contentType,
java.lang.String contentSubType,
java.util.ArrayList<java.lang.String> additionalHeaders,
java.util.ArrayList<java.lang.String> replaceHeaders)
This method is the same as the basic sendRequestWithTransaction(Request,...) method except that it allows the caller to specify a message body and/or additional message headers to add to or replace in the outbound message without requiring knowledge of the JAIN-SIP API. |
SipTransaction |
sendRequestWithTransaction(java.lang.String reqMessage,
boolean viaProxy,
javax.sip.Dialog dialog)
This basic method sends out a request message as part of a transaction. |
SipTransaction |
sendRequestWithTransaction(java.lang.String reqMessage,
boolean viaProxy,
javax.sip.Dialog dialog,
java.util.ArrayList<javax.sip.header.Header> additionalHeaders,
java.util.ArrayList<javax.sip.header.Header> replaceHeaders,
java.lang.String body)
This method is the same as the basic sendRequestWithTransaction(String,...) 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. |
SipTransaction |
sendRequestWithTransaction(java.lang.String reqMessage,
boolean viaProxy,
javax.sip.Dialog dialog,
java.lang.String body,
java.lang.String contentType,
java.lang.String contentSubType,
java.util.ArrayList<java.lang.String> additionalHeaders,
java.util.ArrayList<java.lang.String> replaceHeaders)
This method is the same as the basic sendRequestWithTransaction(String,...) method except that it allows the caller to specify a message body and/or additional message headers to add to or replace in the outbound message without requiring knowledge of the JAIN-SIP API. |
boolean |
sendUnidirectionalRequest(javax.sip.message.Request request,
boolean viaProxy)
This sendUnidirectionalRequest() method sends out a request message with no response expected. |
boolean |
sendUnidirectionalRequest(java.lang.String reqMessage,
boolean viaProxy)
This sendUnidirectionalRequest() method sends out a request message with no response expected. |
boolean |
sendUnidirectionalResponse(javax.sip.RequestEvent request,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires)
This method sends out a stateless response to the given request. |
boolean |
sendUnidirectionalResponse(javax.sip.message.Response response)
The sendUnidirectionalResponse() method sends out a stateless response message. |
boolean |
setPublicAddress(java.lang.String host,
int port)
This method replaces the host/port values currently being used in this Sip agent's contact address, via, and listening point 'sentby' components with the given host and port parameters. |
boolean |
unlistenRequestMessage()
The unlistenRequestMessage() method cancels out a previous directive to listen for reception of a request addressed to this SipSession's URI. |
javax.sip.RequestEvent |
waitRequest(long timeout)
The waitRequest() method waits for a request addressed to this SipSession's URI to be received from the network. |
java.util.EventObject |
waitResponse(SipTransaction trans,
long timeout)
The waitResponse() method waits for a response to a previously sent transactional request message. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SIPUNIT_INTERNAL_RETURNCODE_MIN
SIPUNIT_INTERNAL_RETURNCODE_MIN A constant
marking the lowest possible SipUnit internal return code value. Anything
below this is not internal, but a standard RFC3261 SIP status code. A
test program can refer to this constant or call isInternal() to determine
if the value returned by SipSession.getReturnCode() is an internal
SipUnit return code or a SIP response code received from the network.
public static final int NONE_YET
public static final int EXCEPTION_ENCOUNTERED
public static final int UNSUPPORTED_URI_SCHEME
public static final int INVALID_UNREGISTERED_OPERATION
public static final int TIMEOUT_OCCURRED
public static final int FAR_END_ERROR
public static final int INTERNAL_ERROR
public static final int ERROR_OF_UNKNOWN_ORIGIN
public static final int INVALID_OPERATION
public static final int INVALID_ARGUMENT
public static final int MISSING_CREDENTIAL
public static java.util.HashMap<java.lang.Integer,java.lang.String> statusCodeDescription
statusCodeDescription This map yields a
descriptive string, given an internal sipunit return code.
public static final int MAX_FORWARDS_DEFAULT
| Method Detail |
|---|
public java.lang.String generateNewTag()
public void dispose()
public SipStack getParent()
public java.lang.String getPublicAddress()
public boolean setPublicAddress(java.lang.String host,
int port)
host - The publicly accessible IP address for this Sip client (ex:
66.32.44.112).port - The port to be used with the publicly accessible IP address.
public void processRequest(javax.sip.RequestEvent request)
processRequest in interface javax.sip.SipListenerpublic void processResponse(javax.sip.ResponseEvent response)
processResponse in interface javax.sip.SipListenerpublic void processTimeout(javax.sip.TimeoutEvent timeout)
processTimeout in interface javax.sip.SipListener
public boolean sendUnidirectionalRequest(java.lang.String reqMessage,
boolean viaProxy)
throws java.text.ParseException
StringBuffer invite = new StringBuffer("INVITE sip:becky@"
+ PROXY_HOST + ':' + PROXY_PORT + ";transport="
+ PROXY_PROTO + " SIP/2.0\n");
invite.append("Call-ID: 5ff235b07a7e4c19784d138fb26c1ec8@"
+ thisHostAddr + "\n");
invite.append("CSeq: 1 INVITE\n");
invite.append("From: ;tag=1181356482\n");
invite.append("To: \n");
invite.append("Contact: \n");
invite.append("Max-Forwards: 5\n");
invite.append("Via: SIP/2.0/" + PROXY_PROTO + " " + thisHostAddr
+ ":5060;branch=322e3136382e312e3130303a3530363\n");
invite.append("Event: presence\n");
invite.append("Content-Length: 5\n");
invite.append("\n");
invite.append("12345");
SipTransaction trans = ua.sendRequestWithTransaction(invite
.toString(), true, null);
assertNotNull(ua.format(), trans);
reqMessage - A request message in the form of a String with everything from
the request line and headers to the body. It must be in the
proper format per RFC-3261.viaProxy - If true, send the message to the proxy. In this case the
request URI is modified by this method. Else send it to the
user specified in the given request URI. In this case, for an
INVITE request, a route header must be present for the request
routing to complete. This method does NOT add a route header.
java.text.ParseException - if an error was encountered while parsing the string.
public boolean sendUnidirectionalRequest(javax.sip.message.Request request,
boolean viaProxy)
request - The request to be sent out.viaProxy - If true, send the message to the proxy. In this case a Route
header is added by this method. Else send the message as is.
In this case, for an INVITE request, a route header must have
been added by the caller for the request routing to complete.
public SipTransaction sendRequestWithTransaction(java.lang.String reqMessage,
boolean viaProxy,
javax.sip.Dialog dialog)
throws java.text.ParseException
reqMessage - A request message in the form of a String with everything from
the request line and headers to the body. It must be in the
proper format per RFC-3261.viaProxy - If true, send the message to the proxy. In this case the
request URI is modified by this method. Else send it to the
user specified in the given request URI. In this case, for an
INVITE request, a route header must be present for the request
routing to complete. This method does NOT add a route header.dialog - If not null, send the request via the given dialog. Else send
it outside of any dialog.
java.text.ParseException - if an error is encountered while parsing the string.
public SipTransaction sendRequestWithTransaction(java.lang.String reqMessage,
boolean viaProxy,
javax.sip.Dialog dialog,
java.util.ArrayList<javax.sip.header.Header> additionalHeaders,
java.util.ArrayList<javax.sip.header.Header> replaceHeaders,
java.lang.String body)
throws java.text.ParseException
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.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.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.
java.text.ParseException
public SipTransaction sendRequestWithTransaction(java.lang.String reqMessage,
boolean viaProxy,
javax.sip.Dialog dialog,
java.lang.String body,
java.lang.String contentType,
java.lang.String contentSubType,
java.util.ArrayList<java.lang.String> additionalHeaders,
java.util.ArrayList<java.lang.String> replaceHeaders)
throws java.text.ParseException
body - A String to be used as the body of the message. Parameters
contentType, contentSubType must both be non-null to get the
body included in the message. Use null for no body bytes.contentType - The body content type (ie, 'application' part of
'application/sdp'), required if there is to be any content
(even if body bytes length 0). Use null for no message
content.contentSubType - The body content sub-type (ie, 'sdp' part of
'application/sdp'), required if there is to be any content
(even if body bytes length 0). Use null for no message
content.additionalHeaders - ArrayList of String, each element representing a SIP message
header to add to the outbound message. Examples: "Priority:
Urgent", "Max-Forwards: 10". 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. Unpredictable results may occur if your headers
are not syntactically correct or contain nonsensical values
(the message may not pass through the local SIP stack). Use
null for no additional message headers.replaceHeaders - ArrayList of String, each element representing a SIP message
header to add to the outbound message, replacing existing
header(s) of that type if present in the message. Examples:
"Priority: Urgent", "Max-Forwards: 10". These headers are
applied to the message after a correct message has been
constructed. Unpredictable results may occur if your headers
are not syntactically correct or contain nonsensical values
(the message may not pass through the local SIP stack). Use
null for no replacement of message headers.
java.text.ParseException
public SipTransaction sendRequestWithTransaction(javax.sip.message.Request request,
boolean viaProxy,
javax.sip.Dialog dialog)
request - The request to be sent out.viaProxy - If true, send the message to the proxy. In this case a Route
header is added by this method. Else send the message as is.
In this case, for an INVITE request, a route header must have
been added by the caller for the request routing to complete.dialog - If not null, send the request via the given dialog. Else send
it outside of any dialog.
public SipTransaction sendRequestWithTransaction(javax.sip.message.Request request,
boolean viaProxy,
javax.sip.Dialog dialog,
java.util.ArrayList<javax.sip.header.Header> additionalHeaders,
java.util.ArrayList<javax.sip.header.Header> replaceHeaders,
java.lang.String body)
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.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.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.
public SipTransaction sendRequestWithTransaction(javax.sip.message.Request request,
boolean viaProxy,
javax.sip.Dialog dialog,
java.lang.String body,
java.lang.String contentType,
java.lang.String contentSubType,
java.util.ArrayList<java.lang.String> additionalHeaders,
java.util.ArrayList<java.lang.String> replaceHeaders)
body - A String to be used as the body of the message. Parameters
contentType, contentSubType must both be non-null to get the
body included in the message. Use null for no body bytes.contentType - The body content type (ie, 'application' part of
'application/sdp'), required if there is to be any content
(even if body bytes length 0). Use null for no message
content.contentSubType - The body content sub-type (ie, 'sdp' part of
'application/sdp'), required if there is to be any content
(even if body bytes length 0). Use null for no message
content.additionalHeaders - ArrayList of String, each element representing a SIP message
header to add to the outbound message. Examples: "Priority:
Urgent", "Max-Forwards: 10". 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. Unpredictable results may occur if your headers
are not syntactically correct or contain nonsensical values
(the message may not pass through the local SIP stack). Use
null for no additional message headers.replaceHeaders - ArrayList of String, each element representing a SIP message
header to add to the outbound message, replacing existing
header(s) of that type if present in the message. Examples:
"Priority: Urgent", "Max-Forwards: 10". These headers are
applied to the message after a correct message has been
constructed. Unpredictable results may occur if your headers
are not syntactically correct or contain nonsensical values
(the message may not pass through the local SIP stack). Use
null for no replacement of message headers.
public java.util.EventObject waitResponse(SipTransaction trans,
long timeout)
trans - The SipTransaction object associated with the sent request.timeout - The maximum amount of time to wait, in milliseconds. Use a
value of 0 to wait indefinitely.
public boolean listenRequestMessage()
public boolean unlistenRequestMessage()
public javax.sip.RequestEvent waitRequest(long timeout)
timeout - The maximum amount of time to wait, in milliseconds. Use a
value of 0 to wait indefinitely.
public SipTransaction sendReply(javax.sip.RequestEvent request,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires)
request - The RequestEvent object that was returned by a previous call
to waitRequest().statusCode - The status code of the response to send (may use SipResponse
constants).reasonPhrase - If not null, the reason phrase to send.toTag - If not null, it will be put into the 'To' header of the
response. Required by final responses such as OK.contact - If not null, it will be used to create a 'Contact' header to
be added to the response.expires - If not -1, an 'Expires' header is added to the response
containing this value, which is the time the message is valid,
in seconds.
public SipTransaction sendReply(javax.sip.RequestEvent request,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires,
java.util.ArrayList<javax.sip.header.Header> additionalHeaders,
java.util.ArrayList<javax.sip.header.Header> replaceHeaders,
java.lang.String body)
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.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.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.
public SipTransaction sendReply(javax.sip.RequestEvent request,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires,
java.lang.String body,
java.lang.String contentType,
java.lang.String contentSubType,
java.util.ArrayList<java.lang.String> additionalHeaders,
java.util.ArrayList<java.lang.String> replaceHeaders)
body - A String to be used as the body of the message. Parameters
contentType, contentSubType must both be non-null to get the
body included in the message. Use null for no body bytes.contentType - The body content type (ie, 'application' part of
'application/sdp'), required if there is to be any content
(even if body bytes length 0). Use null for no message
content.contentSubType - The body content sub-type (ie, 'sdp' part of
'application/sdp'), required if there is to be any content
(even if body bytes length 0). Use null for no message
content.additionalHeaders - ArrayList of String, each element representing a SIP message
header to add to the outbound message. Examples: "Priority:
Urgent", "Max-Forwards: 10". 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. Unpredictable results may occur if your headers
are not syntactically correct or contain nonsensical values
(the message may not pass through the local SIP stack). Use
null for no additional message headers.replaceHeaders - ArrayList of String, each element representing a SIP message
header to add to the outbound message, replacing existing
header(s) of that type if present in the message. Examples:
"Priority: Urgent", "Max-Forwards: 10". These headers are
applied to the message after a correct message has been
constructed. Unpredictable results may occur if your headers
are not syntactically correct or contain nonsensical values
(the message may not pass through the local SIP stack). Use
null for no replacement of message headers.
public SipTransaction sendReply(javax.sip.RequestEvent request,
javax.sip.message.Response response)
request - The RequestEvent object that was returned by a previous call
to waitRequest().response - The response to send, as is.
public SipTransaction sendReply(SipTransaction transaction,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires)
transaction - The SipTransaction object returned from a previous call to
sendReply().statusCode - The status code of the response to send (may use SipResponse
constants).reasonPhrase - If not null, the reason phrase to send.toTag - If not null, it will be put into the 'To' header of the
response. Required by final responses such as OK.contact - If not null, it will be used to create a 'Contact' header to
be added to the response.expires - If not -1, an 'Expires' header is added to the response
containing this value, which is the time the message is valid,
in seconds.
public SipTransaction sendReply(SipTransaction transaction,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires,
java.lang.String body,
java.lang.String contentType,
java.lang.String contentSubType,
java.util.ArrayList<java.lang.String> additionalHeaders,
java.util.ArrayList<java.lang.String> replaceHeaders)
body - A String to be used as the body of the message. Parameters
contentType, contentSubType must both be non-null to get the
body included in the message. Use null for no body bytes.contentType - The body content type (ie, 'application' part of
'application/sdp'), required if there is to be any content
(even if body bytes length 0). Use null for no message
content.contentSubType - The body content sub-type (ie, 'sdp' part of
'application/sdp'), required if there is to be any content
(even if body bytes length 0). Use null for no message
content.additionalHeaders - ArrayList of String, each element representing a SIP message
header to add to the outbound message. Examples: "Priority:
Urgent", "Max-Forwards: 10". 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. Unpredictable results may occur if your headers
are not syntactically correct or contain nonsensical values
(the message may not pass through the local SIP stack). Use
null for no additional message headers.replaceHeaders - ArrayList of String, each element representing a SIP message
header to add to the outbound message, replacing existing
header(s) of that type if present in the message. Examples:
"Priority: Urgent", "Max-Forwards: 10". These headers are
applied to the message after a correct message has been
constructed. Unpredictable results may occur if your headers
are not syntactically correct or contain nonsensical values
(the message may not pass through the local SIP stack). Use
null for no replacement of message headers.
public SipTransaction sendReply(SipTransaction transaction,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires,
java.util.ArrayList<javax.sip.header.Header> additionalHeaders,
java.util.ArrayList<javax.sip.header.Header> replaceHeaders,
java.lang.String body)
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.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.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.
public SipTransaction sendReply(SipTransaction transaction,
javax.sip.message.Response response)
transaction - The SipTransaction object returned from a previous call to
sendReply().response - The response to send, as is.
public boolean sendUnidirectionalResponse(javax.sip.message.Response response)
response - The response to be sent out.
public boolean sendUnidirectionalResponse(javax.sip.RequestEvent request,
int statusCode,
java.lang.String reasonPhrase,
java.lang.String toTag,
javax.sip.address.Address contact,
int expires)
request - The RequestEvent object that contains the request we are
responding to.statusCode - The status code of the response to send (may use SipResponse
constants).reasonPhrase - If not null, the reason phrase to send.toTag - If not null, it will be put into the 'To' header of the
response. Required by final responses such as OK.contact - If not null, it will be used to create a 'Contact' header to
be added to the response.expires - If not -1, an 'Expires' header is added to the response
containing this value, which is the time the message is valid,
in seconds.
public javax.sip.header.AuthorizationHeader getAuthorization(java.lang.String method,
java.lang.String uri,
java.lang.String requestBody,
javax.sip.header.WWWAuthenticateHeader authHeader,
java.lang.String username,
java.lang.String password)
throws java.lang.SecurityException
method - method of the request being authenticated.uri - digest-uri. This is the request uri of the request (ie,
request.getRequestURI().toString()).requestBody - the body of the request message being authenticated. IE:
request.getContent()==null?"":request.getContent().toString()authHeader - the challenge that we are responding to. The caller should
pass in one of the following received response headers:
WWWAuthenticateHeader (typically associated with status code
Response.UNAUTHORIZED) or ProxyAuthenticateHeader (usually
associated with status code
Response.PROXY_AUTHENTICATION_REQUIRED).username - the name of the user to send to the challenging serverpassword - the user's password
java.lang.SecurityExceptionpublic java.util.ArrayList<javax.sip.header.ViaHeader> getViaHeaders()
public java.util.ArrayList<javax.sip.header.ViaHeader> getLocalViaHeaders()
public java.lang.String getErrorMessage()
SipActionObject
getErrorMessage in interface SipActionObjectpublic java.lang.Throwable getException()
SipActionObject
getException in interface SipActionObjectpublic int getReturnCode()
SipActionObject
getReturnCode in interface SipActionObjectpublic static boolean isInternal(int returnCode)
returnCode - the return code in question
public java.lang.String format()
SipActionObject
format in interface SipActionObjectpublic java.lang.String getStackAddress()
public void processIOException(javax.sip.IOExceptionEvent arg0)
processIOException in interface javax.sip.SipListenerpublic void processTransactionTerminated(javax.sip.TransactionTerminatedEvent arg0)
processTransactionTerminated in interface javax.sip.SipListenerpublic void processDialogTerminated(javax.sip.DialogTerminatedEvent arg0)
processDialogTerminated in interface javax.sip.SipListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||