|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ProxyBranch
A ProxyBranch
represents a branch which the Proxy sends out the
request on. The ProxyBranch
object models the branch as used in
RFC3261 while describing a stateful proxy.
For example,
public void doInvite(SipServletRequest req) { ... Proxy p = req.getProxy(); p.setRecordRoute(true); Listbranches = p.createProxyBranches(getTargets(req)); branches.get(0).setProxyBranchTimeout(5); branches.get(1).setProxyBranchTimeout(10); p.startProxy(); ... }
Method Summary | |
---|---|
void |
cancel()
Cancels this branch and all the child branches if recursion is enabled and sends a CANCEL to the proxied INVITEs. |
void |
cancel(java.lang.String[] protocol,
int[] reasonCode,
java.lang.String[] reasonText)
This overloaded method of cancel() provides a way to specify the
reason for cancelling this branch by including the appropriate Reason headers [RFC 3326]. |
boolean |
getAddToPath()
Returns true if subsequent invocations of startProxy() will add a Path header
to the proxied request, false otherwise. |
SipURI |
getPathURI()
Returns a SipURI that the application can use to
add parameters to the Path header. |
Proxy |
getProxy()
|
int |
getProxyBranchTimeout()
Returns the current value of the search timeout associated with this ProxyBranch object. |
boolean |
getRecordRoute()
Returns true if subsequent invocations of proxyTo(URI)
will add a Record-Route header to the proxied request, false otherwise. |
SipURI |
getRecordRouteURI()
Returns a SipURI that the application can use to
add parameters to the Record-Route header. |
boolean |
getRecurse()
Returns true if this proxy branch object is set to recurse, or false otherwise. |
java.util.List<ProxyBranch> |
getRecursedProxyBranches()
Receipt of a 3xx class redirect response on a branch can result in recursed branches if the proxy or the branch has recursion enabled. |
SipServletRequest |
getRequest()
Returns the request associated with this branch. |
SipServletResponse |
getResponse()
Returns the last response received on this branch. |
boolean |
isStarted()
The branch can be created using Proxy.createProxyBranches(java.util.List) and may be
started at a later time by using Proxy.startProxy() . |
void |
setAddToPath(boolean p)
Specifies whether this branch should include a Path header for the REGISTER request for this servlet container or not. |
void |
setOutboundInterface(java.net.InetAddress address)
In multi-homed environment this method can be used to select the outbound interface to use when sending requests for this proxy branch. |
void |
setOutboundInterface(java.net.InetSocketAddress address)
In multi-homed environment this method can be used to select the outbound interface and source port number when forwarding requests for this proxy branch. |
void |
setProxyBranchTimeout(int seconds)
Sets the search timeout value for this ProxyBranch object. |
void |
setRecordRoute(boolean rr)
Specifies whether this branch should include a Record-Route header for this servlet engine or not. |
void |
setRecurse(boolean recurse)
Specifies whether the servlet engine will automatically recurse or not. |
Method Detail |
---|
SipServletRequest getRequest()
void cancel()
Proxy.cancel()
except that it is
limited to this branch and its children only.
java.lang.IllegalStateException
- if the transaction has already been completed and it has no
child branchesvoid cancel(java.lang.String[] protocol, int[] reasonCode, java.lang.String[] reasonText)
cancel()
provides a way to specify the
reason for cancelling this branch by including the appropriate Reason headers [RFC 3326].
protocol
- describes the source of the 'cause' field in the Reason header field.reasonCode
- corresponds to the 'cause' field. For eg, if protocol is SIP, the reasonCode
would be the status code of the response which caused the cancelreasonText
- describes the reason for cancelling the Proxy
.int getProxyBranchTimeout()
ProxyBranch
object. If this value is
not explicitly set using the setProxyBranchTimeout(int)
then
the value is inherited from the Proxy
setting.
void setProxyBranchTimeout(int seconds)
ProxyBranch
object.
This is the amount of time the container waits for a final response
when proxying on this branch. This method can be used to
override the default timeout the branch obtains from the Proxy.setProxyTimeout(int)
object. When the timer expires the container CANCELs this branch and
proxies to the next element in the target set in case the proxy is a sequential proxy.
In case the proxy is a parallel proxy then this can only set the timeout value of this
branch to a value lower than the value in the proxy Proxy.getProxyTimeout()
. The
effect of expiry of this timeout in case of parallel proxy is just to cancel this
branch as if an explicit call to cancel()
has been made.
seconds
- new search timeout in seconds
java.lang.IllegalArgumentException
- if this value cannot be set by the container. Either it is too high, too low, negative or
greater than the overall proxy timeout value in parallel case.boolean getRecurse()
void setRecurse(boolean recurse)
recurse
- if true enables recursion, otherwise disables itboolean getRecordRoute()
proxyTo(URI)
will add a Record-Route header to the proxied request, false otherwise.
void setRecordRoute(boolean rr)
Record-routing is used to specify that this servlet engine must stay on the signaling path of subsequent requests.
rr
- if true the engine will record-route, otherwise it won't
java.lang.IllegalStateException
- if the proxy has already been startedboolean getAddToPath()
startProxy()
will add a Path header
to the proxied request, false otherwise.
void setAddToPath(boolean p)
Path header is used to specify that this Proxy must stay on the signaling path of subsequent requests sent to the Registered UA from the Home Proxy in the network. As a best practice, before calling this method a proxy should check if the UA has indicated support for the Path extension by checking the Supported header field value in the request being proxied. The detailed procedure of Path header handling is defined in RFC 3327.
p
- if true the container will add Path headerSipURI getRecordRouteURI()
SipURI
that the application can use to
add parameters to the Record-Route header. This is used by
record-routing proxy applications in order to push state to the
endpoints and have it returned in subsequent requests belonging
to the same dialog.
Parameters added through a URI returned by this method can
be retrieved from a subsequent request in the same dialog by
calling ServletRequest.getParameter(java.lang.String)
.
Note that the URI returned is good only for specifying a set of parameters that the application can retrieve when invoked to handle subsequent requests in the same dialog. Other components of the URI are irrelevant and cannot be trusted to reflect the actual values that the container will be using when inserting a Record-Route header into proxied request.
java.lang.IllegalStateException
- if record-routing is not enabledSipURI getPathURI()
SipURI
that the application can use to
add parameters to the Path header. This may be used by
Path header adding proxy applications in order to push state to the
Registrar and have it returned in subsequent requests for the
registered UA.
Parameters added through a URI returned by this method can
be retrieved from a subsequent request in the same dialog by
calling ServletRequest.getParameter(java.lang.String)
.
Note that the URI returned is good only for specifying a set of parameters that the application can retrieve when invoked to handle subsequent requests Other components of the URI are irrelevant and cannot be trusted to reflect the actual values that the container will be using when inserting a Path header into proxied request.
java.lang.IllegalStateException
- if addToPath is not enabledvoid setOutboundInterface(java.net.InetSocketAddress address)
javax.servlet.sip.outboundInterfaces
.
The port is interpreted as an advice by the app to the container. If the port of the socket address has a non-zero value, the container will make a best-effort attempt to use it as the source port number for UDP packets, or as a source port number for TCP connections it originates. If the port is not available, the container will use its default port allocation scheme.
Invocation of this method also impacts the system headers
generated by the container for this ProxyBranch, such as the
Record-Route
header (getRecordRouteURI()
),
the Via
and the Contact
header.
The IP address part of the socket address
is used to construct
these system headers.
address
- the socket address representing the outbound interface to use when
forwarding requests with this proxy branch
java.lang.IllegalArgumentException
- if the address
is not understood
by the container as one of its outbound interface
java.lang.NullPointerException
- on null address
void setOutboundInterface(java.net.InetAddress address)
javax.servlet.sip.outboundInterfaces
.
Invocation of this method also impacts the system headers
generated by the container for the branch, such as the
Record-Route
header (getRecordRouteURI()
)
and the Via
. The supplied IP address is used to construct
these system headers.
address
- the address which represents the outbound interface
java.lang.IllegalStateException
- if this method is called on an invalidated session
java.lang.IllegalArgumentException
- if the address
does not
represent one of the container's outbound interfaces
java.lang.NullPointerException
- on null address
SipServletResponse getResponse()
SipServletResponse
received, or null if
no response has been received so far.boolean isStarted()
Proxy.createProxyBranches(java.util.List)
and may be
started at a later time by using Proxy.startProxy()
. This method tells if the given
branch has been started yet or not. The branches created as a result of proxyTo
are always started on creation.
java.util.List<ProxyBranch> getRecursedProxyBranches()
ProxyBranch
Proxy getProxy()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |