public interface SipSession extends AttributeStore
createRequest
).
For UACs, SipSession
extend the notion of SIP dialogs
to have well-defined state before a dialog has been established and
after a final non-2xx terminates an early dialog. This allows UACs to
create "subsequent" requests without having an established dialog. The
effect is that the subsequent request will have the same Call-ID,
From and To headers (with the same From tag and without a To tag),
the will exist in the same CSeq space.
All messages are potentially associated with a SipSession
.
The SipSession
can be retrieved from the message by calling
SipServletMessage.getSession()
.
Modifier and Type | Interface and Description |
---|---|
static class |
SipSession.State
Possible SIP dialog states from SipSession FSM.
|
Modifier and Type | Method and Description |
---|---|
SipServletRequest |
createRequest(String method)
Returns a new request object.
|
SipServletRequest |
getActiveInvite(UAMode mode)
This method returns the active invite request, if any on the session.
|
InviteBranch |
getActiveInviteBranch()
This method returns the currently active initial invite branch for the session (or null
if there is no active branch).
|
SipServletRequest |
getActiveRequest(String requestId)
This method allows the application to access an active request using its requestId.
|
Collection<SipServletRequest> |
getActiveRequests(UAMode mode)
This method returns an immutable collection of currently active requests.
|
SipApplicationSession |
getApplicationSession()
Returns the application session with which this
SipSession
is associated. |
Enumeration<String> |
getAttributeNames()
Deprecated.
As of release 2.0, replaced by
AttributeStore.getAttributeNameSet() |
String |
getCallId()
Returns the Call-ID for this
SipSession . |
long |
getCreationTime()
Returns the time when this session was created, measured in
milliseconds since midnight January 1, 1970 GMT.
|
Flow |
getFlow()
Returns the flow used for sending or receiving messages
in this
SipSession . |
ForkingContext |
getForkingContext()
Returns the instance of
ForkingContext which this SipSession
is part of. |
String |
getId()
Returns a string containing the unique identifier assigned to
this session.
|
boolean |
getInvalidateWhenReady()
Returns true if the container will notify the application when this
SipSession is in the ready-to-invalidate state. |
SessionKeepAlive |
getKeepAlive()
Return the
SessionKeepAlive of the session. |
long |
getLastAccessedTime()
Returns the last time the client sent a request associated with this
session, as the number of milliseconds since midnight January 1,
1970 GMT.
|
Address |
getLocalParty()
Returns the
Address identifying the local party. |
SipApplicationRoutingRegion |
getRegion()
This method allows the application to obtain the region it was
invoked in for this SipSession.
|
Address |
getRemoteParty()
Returns the
Address identifying the remote party. |
javax.servlet.ServletContext |
getServletContext()
Returns the ServletContext to which this session belongs.
|
SipSession.State |
getState()
Returns the current SIP dialog state, which is one of INITIAL, EARLY,
CONFIRMED, or TERMINATED.
|
URI |
getSubscriberURI()
Returns the URI of the subscriber for which this application
is invoked to serve.
|
SipServletResponse |
getUnacknowledgedProvisionalResponse(String provisionalResponseId)
This method returns a reliable provisional response using its id.
|
Collection<SipServletResponse> |
getUnacknowledgedProvisionalResponses(UAMode mode)
This method returns an immutable collection of unacknowledged reliable provisional responses
for the session.
|
void |
invalidate()
Invalidates this session and unbinds any objects bound to it.
|
boolean |
isReadyToInvalidate()
Returns true if this session is in a ready-to-invalidate state.
|
boolean |
isValid()
Returns true if this SipSession is valid, false otherwise.
|
void |
setFlow(Flow flow)
Indicate that the specified flow be used while sending messages on this
SipSession . |
void |
setHandler(String name)
Sets the handler for this
SipSession . |
void |
setInvalidateWhenReady(boolean invalidateWhenReady)
Specifies whether the container should notify the application when the
SipSession is in the ready-to-invalidate state as defined above.
|
void |
setOutboundInterface(InetAddress address)
In multi-homed environment this method can be used to select
the outbound interface to use when sending requests for this SipSession.
|
void |
setOutboundInterface(InetSocketAddress address)
In multi-homed environment this method can be used to select
the outbound interface and source port number to use when sending
requests for this SipSession.
|
void |
terminateDialog()
Terminates the associated dialog.
|
void |
terminateDialog(AutomaticProcessingListener listener)
Terminates the associated dialog.
|
void |
terminateProxiedDialog()
Terminates a SIP dialog that has been proxied.
|
void |
terminateProxiedDialog(AutomaticProcessingListener listener)
Terminates a SIP dialog that has been proxied.
|
void |
terminateProxiedDialog(UAMode direction)
Terminates a SIP dialog that has been proxied.
|
void |
terminateProxiedDialog(UAMode direction,
AutomaticProcessingListener listener)
Terminates a SIP dialog that has been proxied.
|
clearAttributes, getAttribute, getAttributeNameSet, removeAttribute, setAttribute
long getCreationTime()
String getId()
long getLastAccessedTime()
void terminateDialog()
IllegalStateException
- If this method is called when the
dialog termination has already been initiated or if the session
is created by any SIP method that does not establish dialog.void terminateDialog(AutomaticProcessingListener listener)
AutomaticProcessingListener
instance is used to receive all the messages sent or receives after
the application calls this method.listener
- Instance of AutomaticProcessingListener
.IllegalStateException
- If this method is called when the
dialog termination has already been initiated or if the session
is created by any SIP method that does not establish a dialog.void terminateProxiedDialog()
IllegalStateException
- If this method is called when the
dialog termination has already been initiated or if the session
is created by any SIP method that does not establish a dialog.void terminateProxiedDialog(AutomaticProcessingListener listener)
listener
- Instance of AutomaticProcessingListener.IllegalStateException
- If this method is called when the
dialog termination has already been initiated or if the session
is created by any SIP method that does not establish a dialog.void terminateProxiedDialog(UAMode direction)
direction
- the direction in which messages must be sent in order to terminate the dialog.IllegalStateException
- If this method is called when the
dialog termination has already been initiated or if the session
is created by any SIP method that does not establish a dialog.void terminateProxiedDialog(UAMode direction, AutomaticProcessingListener listener)
direction
- the direction in which messages must be sent in order to terminate the dialog.listener
- Instance of AutomaticProcessingListener.IllegalStateException
- If this method is called when the
dialog termination has already been initiated or if the session
is created by any SIP method that does not establish a dialog.void invalidate()
IllegalStateException
- if this method is called on an invalidated sessionboolean isReadyToInvalidate()
SipSession
is in the ready-to-invalidate state under any
of the following conditions:
IllegalStateException
- if this method is called on an invalidated sessionvoid setInvalidateWhenReady(boolean invalidateWhenReady)
SipSessionListener.sessionReadyToInvalidate
callback.invalidateWhenReady
- if true, the container will observe this session
and notify the application when it is in the ready-to-invalidate state.
The session is not observed if the flag is false.
The default is true for v1.1 applications and false for v1.0
applications.IllegalStateException
- if this method is called on an invalidated sessionisReadyToInvalidate()
,
SipSessionListener.sessionReadyToInvalidate(SipSessionEvent se)
boolean getInvalidateWhenReady()
SipSession
is in the ready-to-invalidate state.IllegalStateException
- if this method is called on an invalidated sessionisReadyToInvalidate()
SipApplicationSession getApplicationSession()
SipSession
is associated. If none exists, then a new one is created and returned
after associating it with this SipSession
.SipSession
ForkingContext getForkingContext()
ForkingContext
which this SipSession
is part of.ForkingContext
IllegalStateException
- if this method is called on an invalidated sessionForkingContext
String getCallId()
SipSession
. This is the
value of the Call-ID header for all messages belonging to this session.SipSession
Address getLocalParty()
Address
identifying the local party. This is
the value of the From header of locally initiated requests in this leg.Address getRemoteParty()
Address
identifying the remote party. This is
the value of the To header of locally initiated requests in this leg.SipServletRequest createRequest(String method)
Note that this method must not be used to create ACK or
CANCEL requests. User agents create ACKs by calling SipServletResponse.createAck()
and CANCELs are created by
calling SipServletRequest.createCancel()
.
method
- the SIP method of the new requestIllegalArgumentException
- if method
is not a syntactically valid
SIP method or if it's "ACK" or "CANCEL"IllegalStateException
- if this SipSession
has been invalidated or
if this SipSession
is in the INITIAL state and there
is an ongoing transaction or
if this SipSession
is in the TERMINATED
statevoid setHandler(String name) throws javax.servlet.ServletException
SipSession
.
This method can be used to
explicitly specify the name of the servlet which should handle all
subsequently received messages for this SipSession
.
The servlet must belong to the same application (i.e. same
ServletContext
) as the caller.name
- name of the servlet to be invoked for incoming
SIP messages belonging to this SipSession
javax.servlet.ServletException
- if no servlet with the specified name
exists in this applicationIllegalStateException
- if this method is called on an invalidated session@Deprecated Enumeration<String> getAttributeNames()
AttributeStore.getAttributeNameSet()
SipSession.State getState()
IllegalStateException
- if this method is called on an invalidated sessionvoid setOutboundInterface(InetSocketAddress address)
javax.servlet.sip.outboundAddresses
and
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 SipSession, such as the
the Via
and the Contact
headers.
The IP address part of the socket address
is used to construct
these system headers.
address
- the socket address which represents the outbound interfaceIllegalStateException
- if this method is called on an invalidated sessionIllegalArgumentException
- if the address
is not understood
by the container as one of its outbound interfacesNullPointerException
- on null address
void setOutboundInterface(InetAddress address)
javax.servlet.sip.outboundAddresses
and
javax.servlet.sip.outboundInterfaces
.
Invocation of this method also impacts the system headers
generated by the container for this message, such as the
the Via
and the Contact
header.
The supplied IP address is used to construct
these system headers.
address
- the address which represents the outbound interfaceIllegalStateException
- if this method is called on an invalidated sessionIllegalArgumentException
- if the address
does not
represent one of the container's outbound interfacesNullPointerException
- on null address
void setFlow(Flow flow)
SipSession
.flow
- Flow
instance to be used while sending the messages.IllegalArgumentException
- if the Flow
does not exist or the
transport association represented by the flow is broken or not known
to the container.Flow
Flow getFlow()
SipSession
.Flow
Returns the instance flow that is used for sending or
receiving the message. Null, if there is no flow as per RFC 5626 is associated
with this session.Flow
boolean isValid()
invalidate()
on it or if its invalidateWhenReady flag
is true and it transitions to the ready-to-invalidate state.
Also the SipSession can be invalidated by the container when either the associated
SipApplicationSession
times out or
SipApplicationSession.invalidate()
is invoked.SipApplicationRoutingRegion getRegion()
SipSession.getSubscriberURI()
.
If this SipSession is created when this servlet receives an initial
request, this method returns the region in which this servlet is invoked.
The SipApplicationRoutingRegion
is only available if this
SipSession received an initial request. Otherwise, this method throws
IllegalStateException.
IllegalStateException
- if this method is called on an invalidated sessionURI getSubscriberURI()
IllegalStateException
- if this method is called on an invalidated sessionjavax.servlet.ServletContext getServletContext()
SipSession
belonging to a distributed application
deployed to a distributed container may be available across JVMs , this method
returns the context that is local to the JVM on which it was invoked.ServletContext
SessionKeepAlive getKeepAlive()
SessionKeepAlive
of the session.SessionKeepAlive
of this session.SessionKeepAlive
SipServletRequest getActiveRequest(String requestId)
requestId
- SipServletRequest
with the specified requestId
Collection<SipServletRequest> getActiveRequests(UAMode mode)
mode
- Indicates whether the requests is incoming (UAS) or outgoing(UAC)SipServletRequest
objects with the specified mode
SipServletRequest getActiveInvite(UAMode mode)
mode
- Indicates whether the invite request is incoming (UAS) or outgoing(UAC)SipServletResponse getUnacknowledgedProvisionalResponse(String provisionalResponseId)
provisionalResponseId
- String
that identifies the reliable provisional response.responseId
. Null,
if there are no unacknowledged provisional response matching the responseId
is present.Collection<SipServletResponse> getUnacknowledgedProvisionalResponses(UAMode mode)
mode
- Indicates whether the mode is incoming (UAS) or outgoing(UAC)InviteBranch getActiveInviteBranch()
InviteBranch
object.Copyright © 1996-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.