public interface IncomingSipRequest extends SipRequest
SipSession
. Only initial requests may be proxied.
Subsequent requests (in-dialog requests) do not need to be proxied, they
will automatically follow the route established by the initial request.Modifier and Type | Method and Description |
---|---|
OutgoingSipResponse |
createForkedResponse(IncomingSipResponse incoming)
Creates a new outgoing response and a new
SipSession , for forwarding forked
responses upstream. |
OutgoingSipResponse |
createForkedResponse(int statusCode)
Create a response for this request, with the specified status code, and a new
SipSession ,
for sending responses upstream. |
OutgoingSipResponse |
createForkedResponse(int statusCode,
String reasonPhrase)
Create a response for this request, with the specified status code and reason phrase, and a new
SipSession ,
for sending responses upstream. |
OutgoingSipResponse |
createResponse(IncomingSipResponse incoming)
Create a response for this request, copying any additional headers and content
from an
IncomingSipResponse received on another session. |
OutgoingSipResponse |
createResponse(int statusCode)
Create a response for this request, with the specified status code.
|
OutgoingSipResponse |
createResponse(int statusCode,
String reasonPhrase)
Create a response for this request, with the specified status code and reason phrase.
|
StatelessSipResponse |
createStatelessResponse(int statusCode,
String reasonPhrase)
Create a provisional
stateless response for this request,
with the specified status code and reason phrase. |
OutgoingSipResponse |
getFinalResponse()
Gets the final response that was sent in response to this request.
|
Proxy |
getProxy()
Returns the
Proxy activity for this request, creating one if it did not already exist. |
Proxy |
getProxy(boolean create)
Returns the
Proxy activity for this request. |
boolean |
isForked()
Determines whether this request was the result of a downstream element forking the initial request.
|
getMaxForwards, getRequestURI, isInitial, pushRoute, pushRoute, setMaxForwards, setRequestURI
addAcceptLanguage, addAddressHeader, addHeader, addHeaderGeneric, addParameterableHeader, getAcceptLanguage, getAcceptLanguages, getAddressHeader, getAddressHeaders, getCallId, getCharacterEncoding, getContent, getContentLanguage, getContentLength, getContentType, getExpires, getFrom, getHeader, getHeaderGeneric, getHeaderNames, getHeaders, getHeadersGeneric, getLocalAddr, getLocalPort, getMethod, getParameterableHeader, getParameterableHeaders, getProtocol, getRawContent, getRemoteAddr, getRemotePort, getRemoteUser, getSequenceNumber, getSession, getSession, getTo, getTransport, getUserPrincipal, isCommitted, isExtensionRequired, isExtensionSupported, isSecure, isUserInRole, removeHeader, setAcceptLanguage, setAddressHeader, setCharacterEncoding, setContent, setContentLanguage, setContentType, setExpires, setHeader, setHeaderGeneric, setParameterableHeader
OutgoingSipResponse createResponse(int statusCode)
statusCode
- status code for the responseOutgoingSipResponse
object with the specified status code.OutgoingSipResponse createResponse(int statusCode, String reasonPhrase)
statusCode
- status code for the responsereasonPhrase
- reason phrase for the responseOutgoingSipResponse
object with the specified status code and reason phrase.StatelessSipResponse createStatelessResponse(int statusCode, String reasonPhrase)
stateless response
for this request,
with the specified status code and reason phrase. Sending this stateless response will
not affect session state.statusCode
- status code for the response, must be between 100 and 199reasonPhrase
- reason phrase for the response, may be nullStatelessSipResponse
object with the specified status code and reason phrase,
and a to-tag that will not match the local tag of this session.IllegalArgumentException
- if statusCode is less than 100 or greater than 199OutgoingSipResponse createResponse(IncomingSipResponse incoming)
IncomingSipResponse
received on another session. This is a
convenience method for B2BUAs to forward responses easily.incoming
- OutgoingSipResponse
with the status code, content and additional headers
from the original incoming responseOutgoingSipResponse createForkedResponse(IncomingSipResponse incoming)
SipSession
, for forwarding forked
responses upstream. This is a convenience method so that B2BUAs handling several UAC SipSessions
created by a downstream element forking can easily create the corresponding UAS SipSessions,
and handle early dialog interactions on those SipSessions. The new forked UAS session can
be obtained by calling SipMessage.getSession()
on the
returned OutgoingSipResponse
. The caller should then send the response upstream by
calling its send()
method.incoming
- a forked
IncomingSipResponse
received on a UAC SipSessionOutgoingSipResponse
with the status code, content and additional headers
from the original incoming response. The Call-Id and from-tag will match the original UAS SipSession
created by the initial request, and the to-tag will be copied from the incoming response.IllegalStateException
- if the request was not an initial requestIllegalArgumentException
- if the response was not a forked response, see
IncomingSipResponse.isForked()
OutgoingSipResponse createForkedResponse(int statusCode)
SipSession
,
for sending responses upstream. The new forked UAS session can be obtained by calling
SipMessage.getSession()
on the
returned OutgoingSipResponse
. The caller should then send the response upstream by
calling its send()
method.statusCode
- status code for the responseOutgoingSipResponse
object with the specified status code.
The Call-Id and from-tag will match the original UAS SipSession
created by the initial request, and the to-tag will be new.IllegalStateException
- if the request was not an initial requestIllegalArgumentException
- if the response is not a dialog creating response
IncomingSipResponse.isForked()
OutgoingSipResponse createForkedResponse(int statusCode, String reasonPhrase)
SipSession
,
for sending responses upstream. The new forked UAS session can be obtained by calling
SipMessage.getSession()
on the
returned OutgoingSipResponse
. The caller should then send the response upstream by
calling its send()
method.statusCode
- status code for the responsereasonPhrase
- reason phrase for the responseOutgoingSipResponse
object with the specified status code and reason phrase.
The Call-Id and from-tag will match the original UAS SipSession
created by the initial request, and the to-tag will be new.IllegalStateException
- if the request was not an initial requestIllegalArgumentException
- if the response is not a dialog creating response
IncomingSipResponse.isForked()
Proxy getProxy() throws TooManyHopsException, IllegalStateException
Proxy
activity for this request, creating one if it did not already exist.
This behaves like getProxy(true)
.Proxy
activity associated with this requestTooManyHopsException
- if this request's Max-Forwards header is zero.IllegalStateException
- if a final response has already been sent for this request; or if the
application has already sent a dialog-creating response (indicating it wants to be the UAS for this
session); or if this request is not an initial request.Proxy getProxy(boolean create) throws TooManyHopsException, IllegalStateException
Proxy
activity for this request. If no proxy has yet been created for this request,
the create
argument specifies whether a new one should be created or not.create
- specifies whether or not to create a proxy activity one is not already associated with this request.Proxy
activity associated with this request, or null
if no such activity exists and
create
is false
.TooManyHopsException
- if this request's Max-Forwards header is zero.IllegalStateException
- if a final response has already been sent for this request; or if the
application has already sent a dialog-creating response (indicating it wants to be the UAS for this
session); or if this request is not an initial request.OutgoingSipResponse getFinalResponse()
getFinalResponse
in interface SipRequest
null
if no response has been sent yet.boolean isForked()
Currently this may only be a NOTIFY, resulting from a forked initial SUBSCRIBE request.
Each forked NOTIFY creates a new SipSession
activity representing the new dialog that
was created by the fork.
Forked request events are fired on the ACI of the original SipSession; this is
because the service will already be attached to this ACI, and doesn't know about the forked sessions
until requests arrive. The SipMessage.getSession()
method on forked requests returns the SipSession that resulted from the fork, so services
can retrieve and attach to these activities if necessary.
Forked NOTIFYs may be received when proxying (with record-route) or acting as a UAC/B2BUA.
When proxying, if a forked NOTIFY is received, the application just needs to attach to the
new SipSession of the forked NOTIFY request. A B2BUA must forward the NOTIFY upstream using
SipSession.createForkedNotify(IncomingSipRequest)
, which creates the new SipSession
on the upstream side.
Subsequent messages may arrive on sessions that were created by an earlier forked NOTIFY. These subsequent messages are not forked, and will be delivered on their respective SipSessions. Therefore a service that wants to see all subsequent messages on all forked sessions must attach to forked sessions when they are detected.
true
if this request is the result of a downstream element forking;
otherwise false
.