SIP Servlet Engine© Documentations
 
  Top >   System Management >   Development Tools >   ProxyServlet
 
 

ProxyServlet

Overview

The SIP servlet that proxies an SIP message from a user agent (UA).

ProxyServlet is an SIP servlet that implements the proxy server function defined in RFC3261 and uses the Proxy class defined by the SIP Servlet API. Note that the current version of this SIP proxy servlet does not fully conform to RFC3261 because the proxy server specification defined in it is so enormous.*1

ProxyServlet provides the followings as the main functions.

  • The routing function through the Record-Route header
  • The forking function (in parallel or in sequence)
  • The redirecting function for a 3xx response
  • The function that starts to record a voice mail when receiving an error response (by working with RecorderServlet)
  • The function that responds to a CANCEL

In addition, ProxyServlet provides the followings as the functions specific to this proxy.

Forking Behavior

The forking function provided by ProxyServlet uses the following addresses as forking destinations.

If the proxy destination is online:
ProxyServlet uses a list of contact information retrieved from the location server as forking destinations.
If the proxy destination is offline or unknown:
ProxyServlet uses a list of the SIP URIs specified in the downstream parameter as forking destinations.

Collaboration with Web

If the web-redirect parameter is specified, ProxyServlet changes an error response (4xx, 5xx, 6xx) that is the final response to one of the INVITE messages it proxied to a 302 response, and set its Contact header to the HTTP URL specified in the web-redirect parameter.

The client which supports the HTTP URL contact information (such as OkiSoftphone) will automatically start a Web browser and access to the specified URL when receiving this response.

The sip-demo application displays a Web page that asks a user if he/she records a voice mail or not at this HTTP URL. When the user selects Yes, RecorderServlet starts to record a voice mail. This Web collaboration function provided by ProxyServlet allows a user to select his /her action through Web-based functions. (This process had been performing only through voice-based functions.)

Initialization Parameters

The following table lists the initialization parameters you can set in ProxyServlet.

Parameter name Default value Description
downstream None Specifies the destination of the request used when contact information does not exist on the location server. Usually, this destination indicates the upper proxy server. You can specify multiple SIP URIs. When you specify multiple destinations, separate them by a comma ",".
Example: sip:192.168.1.100:5060
record-route false The flag that specifies whether the Record-Route header should be added or not when proxying a request. If set to true, the Record-Route header is added. If set to false, the Record-Route header is not added.
parallel false The flag that specifies whether the forking process should be performed in parallel or in sequence. If set to true, the process is performed in parallel. If set to false, it is performed in sequence.
supervised false The flag that specifies whether an intermediate response during proxy process should be received or not.
recurse false The flag that specifies, when receiving a redirect (3xx) response, whether its contact address should be used as a new proxy destination. If set to true, ProxyServlet attempts each contact address for a 3xx response.
sequential-timeout 30 Specifies the timeout period for one destination, in seconds, when the forking process is performed in sequence.
web-redirect None Specifies the HTTP URL to be set in the Contact header when the ProxyServlet has failed to perform proxying.
Example: http://hostname/sip-demo/home/redirectRecorder.jsp

proxy in the <proxy-policy> of the sipserver.xml takes precedence over the setting in the downstream parameter.

Some initialization parameters described above (record-route, parallel, supervised, and recurse) conform to the Proxy class API defined by the SIP Servlet API. For more information about these flags, see SIP Servlet API Specification or JavaDoc.

External Interfaces

ProxyServlet uses the following SPI:

  • User Management Interface
  • Location Management Interface

Related File

The ProxyServlet setting should be defined in the sip.xml.

Example

Here is an example of the sip.xml.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sip-app
   PUBLIC "-//Java Community Process//DTD SIP Application 1.0//EN"
   "http://www.jcp.org/dtd/sip-app_1_0.dtd">

<sip-app>
  <display-name>A Simple SIP Servlet Proxy Application</display-name>

  <servlet>
    <servlet-name>proxy</servlet-name>
    <servlet-class>com.oki.sip.apps.proxy.ProxyServlet</servlet-class>
      <init-param>
        <param-name>downstream</param-name>
        <param-value>sip:foo.com:5060;transport=udp</param-value>
      </init-param>
      <init-param>
        <param-name>record-route</param-name>
        <param-value>true</param-value>
      </init-param>
      <init-param>
        <param-name>parallel</param-name>
        <param-value>true</param-value>
      </init-param>
      <init-param>
        <param-name>supervised</param-name>
        <param-value>true</param-value>
      </init-param>
      <init-param>
        <param-name>recurse</param-name>
        <param-value>true</param-value>
      </init-param>
      <init-param>
        <param-name>sequential-timeout</param-name>
        <param-value>20</param-value>
      </init-param>
      <init-param>
        <param-name>web-redirect</param-name>
        <param-value>http://foo.com/bar</param-value>
      </init-param>
    <load-on-startup/>
  </servlet>

  <servlet-mapping>
    <servlet-name>proxy</servlet-name>
    <pattern>
      <or>
        <equal>
          <var>request.method</var>
          <value>MESSAGE</value>
        </equal>
        <equal>
          <var>request.method</var>
          <value>INVITE</value>
        </equal>
        <equal>
          <var>request.method</var>
          <value>ACK</value>
        </equal>
      </or>
    </pattern>
  </servlet-mapping>

  <session-config>
    <session-timeout>1</session-timeout>
  </session-config>
</sip-app>

Reference


*1: However, ProxyServlet can connect to most SIP terminals successfully.

Last Modified:Tue Dec 28 14:12:32 JST 2004