Oracle Server E10293-02 User Manual
Classes and Methods
SIP Servlets 2-7
Servlet Mapping
A SIP application can contain one or more SIP Servlets. When the SIP container
receives SIP requests, the container selects a SIP application to serve the request. The
SIP application then evaluates its rules (that is, the servlet-mapping defined in the
sip.xml
receives SIP requests, the container selects a SIP application to serve the request. The
SIP application then evaluates its rules (that is, the servlet-mapping defined in the
sip.xml
file) to find the appropriate SIP servlet that responds to the request. The SIP
application then uses the first SIP servlet that matches the request.
For example, if the SIP container receives an INVITE request, the container selects a
SIP application containing the following SIP Servlets to match the request:
SIP application containing the following SIP Servlets to match the request:
■
Servlet 1 - Invoked for INVITE requests.
■
Servlet 2 - Invoke for MESSAGE requests.
■
Servlet 3 - Invoked for all requests.
The SIP application then attempts to find a match by evaluating its rules from the top
to the bottom. In this case, Servlet 1 and Servlet 3 both match the INVITE request.
Since only one of these servlets can serve the request and since the application reviews
the rules sequentially, the application selects Servlet 1. Servlet 1 starves out Servlet 3. If
the SIP container receives a MESSAGE request, then the application invokes Servlet 2.
For REGISTER requests, the application invokes Servlet 3, the only servlet able to
serve this type of request. If the application does not include Servlet 3, the
application’s match method will return null for the REGISTER request and the SIP
container will issue a 403 response, Application choose not to service the request, which
will be written to the log file.
to the bottom. In this case, Servlet 1 and Servlet 3 both match the INVITE request.
Since only one of these servlets can serve the request and since the application reviews
the rules sequentially, the application selects Servlet 1. Servlet 1 starves out Servlet 3. If
the SIP container receives a MESSAGE request, then the application invokes Servlet 2.
For REGISTER requests, the application invokes Servlet 3, the only servlet able to
serve this type of request. If the application does not include Servlet 3, the
application’s match method will return null for the REGISTER request and the SIP
container will issue a 403 response, Application choose not to service the request, which
will be written to the log file.
Classes and Methods
This section introduces the classes and methods in the SIP servlet API.
A SIP Servlet is a class that extends the javax.servlet.sip.SipServlet class
and thereby interacts with a SIP application server to send and receive SIP messages.
and thereby interacts with a SIP application server to send and receive SIP messages.
Request and Response Handling Methods
The servlet overrides the methods needed for the particular service. The two main
methods that the SIP Servlet uses to perform overrides are:
methods that the SIP Servlet uses to perform overrides are:
■
protected void doRequest(SipServletRequest req)
■
protected void doResponse(SipServletResponse resp)
The doRequest() method handles all of the requests and the doResponse()method
handles all of the responses.
handles all of the responses.
Note:
SIP servlets can forward the request to another SIP servlet by
using javax.servlet.ServletRequest.getRequestDispatcher()
Additionally, you can chain applications using the Application
Router. Refer to the Oracle Communication and Mobility Server
Administrator’s Guide.
Router. Refer to the Oracle Communication and Mobility Server
Administrator’s Guide.
Note:
While a SIP application can invoke only one SIP Servlet for a
request, the SIP container can invoke more than one SIP application
for an incoming request using the Application Router.
for an incoming request using the Application Router.