|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface B2buaHelper
Helper class providing support for B2BUA applications. An instance of this
class can be retrieved from a SipServletRequest
by invoking
the method SipServletRequest.getB2buaHelper()
.
Method Summary | |
---|---|
SipServletRequest |
createCancel(SipSession session)
Creates a new CANCEL request to cancel the initial request sent on the other leg. |
SipServletRequest |
createRequest(SipServletRequest origRequest)
Creates a new request object belonging to a new SipSession. |
SipServletRequest |
createRequest(SipServletRequest origRequest,
boolean linked,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> headerMap)
Creates a new request object belonging to a new SipSession. |
SipServletRequest |
createRequest(SipSession session,
SipServletRequest origRequest,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> headerMap)
Creates a new subsequent request based on the specified original request. |
SipServletResponse |
createResponseToOriginalRequest(SipSession session,
int status,
java.lang.String reasonPhrase)
The request that results in creation of a SipSession is termed as the original request, a response to this original request can be created by the application even if the request was committed and application does not have a reference to this Request. |
SipSession |
getLinkedSession(SipSession session)
Returns the other SipSession that is linked to the specified SipSession, or null if none. |
SipServletRequest |
getLinkedSipServletRequest(SipServletRequest req)
If a new request is created based on an existing one with the link argument true using createRequest(SipServletRequest, boolean, java.util.Map)
or using createRequest(SipSession, SipServletRequest, java.util.Map)
the new request gets implicitly linked with the original request. |
java.util.List<SipServletMessage> |
getPendingMessages(SipSession session,
UAMode mode)
For the specified SipSession, returns a List of all uncommitted messages in the order of increasing CSeq number for the given mode of the session. |
void |
linkSipSessions(SipSession session1,
SipSession session2)
Links the specified sessions, such that there is a 1-1 mapping between them. |
void |
unlinkSipSessions(SipSession session)
If the specified SipSession is linked to another session, then unlinks the two sessions from each other. |
Method Detail |
---|
SipSession getLinkedSession(SipSession session)
linkSipSessions(SipSession, SipSession)
or
createRequest(SipServletRequest, boolean, java.util.Map)
session
- the SipSession from which to obtain the linked session
java.lang.IllegalArgumentException
- if the session is invalidSipServletRequest getLinkedSipServletRequest(SipServletRequest req)
createRequest(SipServletRequest, boolean, java.util.Map)
or using createRequest(SipSession, SipServletRequest, java.util.Map)
the new request gets implicitly linked with the original request.
This method is to be used to retrieve the linked request. There is no
explicit linking/unlinking like that of the session for requests. However unlinking
of sessions also result in unlinking of linked requests.
req
- other request
void linkSipSessions(SipSession session1, SipSession session2)
getLinkedSession(javax.servlet.sip.SipSession)
. One SipSession at any given time can be
linked to only one other SipSession belonging to the same
SipApplicationSession. Calling linkSessions()
with already
linked sessions to each other is a no-op and is to be silently ignored, while
calling linkSessions()
with any of the session linked with
other sessions result in java.lang.IllegalArgumentException
session1
- the first SipSession to linksession2
- the other SipSession to link
java.lang.IllegalArgumentException
- if either of the specified sessions
has been terminated or the sessions do not belong to the same
application session or one or both the sessions are already linked
with some other session(s)
java.lang.NullPointerException
- if any of the arguments is nullvoid unlinkSipSessions(SipSession session)
session
- the session to be unlinked
java.lang.IllegalArgumentException
- if the session is not currently linked
to another session or it has been terminatedjava.util.List<SipServletMessage> getPendingMessages(SipSession session, UAMode mode)
session
- the SipSession to check for pending messagesmode
- the mode for which the pending messages are required, one of UAC or UAS
SipServletMessage
objects representing
pending messages for the session, or the empty list if none
java.lang.IllegalArgumentException
- if the session is invalidSipServletResponse createResponseToOriginalRequest(SipSession session, int status, java.lang.String reasonPhrase)
The response thus generated must have a different To
tag from the
other responses generated to the Request and must result in a different
SipSession. In this (and similar) cases the container clones the
original SipSession for the second and subsequentdialogs, as detailed
above. The cloned session object will contain the same application data
but its createRequest method will create requests belonging to that
second or subsequent dialog, that is, with a To
tag specific to that
dialog.
session
- the SipSession for the original requeststatus
- the status code for the responsereasonPhrase
- the reason phrase for the response, or null to use
a default reason phrase
SipServletResponse
java.lang.IllegalStateException
- if a subsequent response is inconsistent
with an already sent response. For example, a 400 response
following a 200 OK response.
java.lang.IllegalArgumentException
- if the session is invalidSipServletRequest createRequest(SipServletRequest origRequest, boolean linked, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headerMap) throws java.lang.IllegalArgumentException, TooManyHopsException
origRequest
in that the method and the majority of header fields are copied
from origRequest
to the new request.
The headerMap parameter can contain From, To, Contact, Route headers and any
non system header. The header field map is then used to override the
headers in the newly created request.
The SipSession created for the new request also shares the same
SipApplicationSession
associated with the original request.
This method satisfies the following rules:
This method provides a convenient and efficient way of constructing the second "leg" of a B2BUA application, giving the additional flexibility of changing the headers including From, To, Contact and Route.
This method will also perform loop detection. If the value of the original request's Max-Forwards header field is 0, then TooManyHopsException is thrown and a 483 (Too many hops) response is sent for the original request. Otherwise, the value of the new requests Max-Forwards header is set to that of the original request minus one.
It is used only for the initial request. Subsequent requests in either leg
must be created using SipSession.createRequest(java.lang.String)
or createRequest(SipSession, SipServletRequest, java.util.Map)
as usual.
origRequest
- request to be "copied"linked
- indicating if the resulting session should be linked with original or notheaderMap
- a simple map containing header names and their
values to be overridden in the new request. The values can be a specified in a
java.util.List
to accomodate for multi-valued headers
java.lang.IllegalArgumentException
- if the headerMap contains a system
header other than From, To, Contact and Route (see section 4.1.3 to see what part of Contact header is to be used)
or some other header not relevant for the context, or the origRequest
and
its session is linked to some other request/session and the linked
flag is true,
or if the origRequest
is not initial
java.lang.NullPointerException
- if the original request is null
TooManyHopsException
- if the original request's Max-Forwards header value is 0SipServletRequest createRequest(SipServletRequest origRequest)
origRequest
in that the method and the majority of header fields are copied
from origRequest
to the new request. The SipSession
created for the new request also shares the same SipApplicationSession
associated with the original request.
This method satisfies the following rules:
SipSession
)is
assigned a new Call-ID.
This method provides a convenient and efficient way of
constructing a new "leg" of a B2BUA application. It is used
only for the initial request. Subsequent requests in either leg
must be created using SipSession.createRequest(java.lang.String)
or
createRequest(SipSession, SipServletRequest, java.util.Map)
as usual.
origRequest
- request to be "copied"
SipServletRequest createRequest(SipSession session, SipServletRequest origRequest, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headerMap) throws java.lang.IllegalArgumentException
This method, though similar to the factory method of creating the
request for a B2BUA for initial requests, is to be used for subsequent
requests.
The semantics are similar to SipSession.createRequest(String)
except that here it copies non system headers from the original request
onto the new request, the system headers are created based on the session
that this request is created on. Further the Route headers are set as
based on the session route set. The method of the new request is same
as that of the origRequest
. If Contact header is present in
the headerMap then relevant portions of the Contact header are to be used
in the request created, in accordance with section 4.1.3 of the specification.
If From and To headers are present in the headerMap then all parts of
those headers except the tag parameter are to be used in the request
created, in accordance with section 4.1.2 of the specification.
session
- the session on which this request is to be createdorigRequest
- the original requestheaderMap
- the header map used to override the headers in the new
subsequent request created. Also see
createRequest(SipServletRequest, boolean, java.util.Map)
java.lang.IllegalArgumentException
- if the header map contains a system
header other than Contact, From or To (see sections 4.1.2 and 4.1.3 of
specification document) or other header which does not makes sense in the context,
or in case when the session
does not belong to the same
SipApplicationSession as the origRequest
, or the original request or session is
already linked with some other request/session,
or if the origRequest
is not initial
java.lang.NullPointerException
- if the original request or the session is nullSipServletRequest createCancel(SipSession session)
session
- the session whose initial request is to be cancelled.
java.lang.NullPointerException
- if the session is null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |