
path Module

Andreas Granig

   Inode GmbH

Edited by

Andreas Granig

   Copyright © 2006 Inode GmbH
     _________________________________________________________

   Table of Contents
   1. User's Guide

        1.1. Overview

              1.1.1. Path insertion for registrations
              1.1.2. Outbound routing to NAT'ed UACs

        1.2. Dependencies

              1.2.1. OpenSER Modules
              1.2.2. External Libraries or Applications

        1.3. Exported Parameters

              1.3.1. use_received (int)

        1.4. Exported Functions

              1.4.1. add_path()
              1.4.2. add_path(user)
              1.4.3. add_path_received()
              1.4.4. add_path_received(user)

   2. Developer's Guide
   3. Frequently Asked Questions

   List of Examples
   1-1. Set use_received parameter
   1-2. add_path usage
   1-3. add_path(user) usage
   1-4. add_path_received() usage
   1-5. add_path_received(user) usage
     _________________________________________________________

Chapter 1. User's Guide

1.1. Overview

   This module is designed to be used at intermediate sip proxies
   like loadbalancers in front of registrars and proxies. It
   provides functions for inserting a Path header including a
   parameter for passing forward the received-URI of a
   registration to the next hop. It also provides a mechanism for
   evaluating this parameter in subsequent requests and to set
   the destination URI according to it.
     _________________________________________________________

1.1.1. Path insertion for registrations

   For registrations in a scenario like "[UAC] -> [P1] -> [REG]",
   the "path" module can be used at the intermediate proxy P1 to
   insert a Path header into the message before forwarding it to
   the registrar REG. Two functions can be used to achieve this:

     * add_path(...) adds a Path header in the form of "Path:
       <sip:1.2.3.4;lr>" to the message using the address of the
       outgoing interface. A port is only added if it's not the
       default port 5060.
       If a username is passed to the function, it is also
       included in the Path URI, like "Path:
       <sip:username@1.2.3.4;lr>".
     * add_path_received(...) also add a Path header in the same
       form as above, but also adds a parameter indicating the
       received-URI of the message, like "Path:
       <sip:1.2.3.4;received=sip:2.3.4.5:1234;lr>". This is
       especially useful if the proxy does NAT detection and
       wants to pass the NAT'ed address to the registrar.
       If the function is called with a username, it's included
       in the Path URI too.
     _________________________________________________________

1.1.2. Outbound routing to NAT'ed UACs

   If the NAT'ed address of an UAC is passed to the registrar,
   the registrar routes back subsequent requests using the Path
   header of the registration as Route header of the current
   request. If the intermediate proxy had inserted a Path header
   including the "received" parameter during the registration,
   this parameter will show up in the Route header of the new
   request as well, allowing the intermediate proxy to route to
   this address instead of the one propagated in the Route URI
   for tunneling through NAT. This behaviour can be activated by
   setting the module parameter "use_received".
     _________________________________________________________

1.2. Dependencies

1.2.1. OpenSER Modules

   The following modules must be loaded before this module:

     * The "rr" module is needed for outbound routing according
       to the "received" parameter.
     _________________________________________________________

1.2.2. External Libraries or Applications

   The following libraries or applications must be installed
   before running OpenSER with this module loaded:

     * None.
     _________________________________________________________

1.3. Exported Parameters

1.3.1. use_received (int)

   If set to 1, the "received" parameter of the first Route URI
   is evaluated and used as destination-URI if present.

   Default value is 0. 

   Example 1-1. Set use_received parameter
...
modparam("path", "use_received", 1)
...
     _________________________________________________________

1.4. Exported Functions

1.4.1. add_path()

   This function is used to insert a Path header in the form
   "Path: <sip:1.2.3.4;lr>", where "1.2.3.4" is the address of
   the outgoing interface.

   This function can be used from REQUEST_ROUTE.

   Example 1-2. add_path usage
...
if (!add_path()) {
        sl_send_reply("503", "Internal Path Error");
        ...
};
...
     _________________________________________________________

1.4.2. add_path(user)

   This function adds a Path header in the form "Path:
   <sip:user@1.2.3.4;lr>".

   Meaning of the parameters is as follows:

     * user - The username to be inserted as user part.

   This function can be used from REQUEST_ROUTE.

   Example 1-3. add_path(user) usage
...
if (!add_path("loadbalancer")) {
        sl_send_reply("503", "Internal Path Error");
        ...
};
...
     _________________________________________________________

1.4.3. add_path_received()

   This function adds a Path header in the form "Path:
   <sip:1.2.3.4;received=sip:2.3.4.5:1234;lr>", setting it's own
   outgoing address as domain-part, and the address the request
   has been received from as received-parameter.

   This function can be used from REQUEST_ROUTE.

   Example 1-4. add_path_received() usage
...
if (!add_path_received()) {
        sl_send_reply("503", "Internal Path Error");
        ...
};
...
     _________________________________________________________

1.4.4. add_path_received(user)

   This function adds a Path header in the form "Path:
   <sip:user@1.2.3.4;received=sip:2.3.4.5:1234;lr>", setting
   'user' as username part of address, it's own outgoing address
   as domain-part, and the address the request has been received
   from as received-parameter.

   This function can be used from REQUEST_ROUTE.

   Example 1-5. add_path_received(user) usage
...
if (!add_path_received("inbound")) {
        sl_send_reply("503", "Internal Path Error");
        ...
};
...
     _________________________________________________________

Chapter 2. Developer's Guide

   The module does not provide any API to use in other OpenSER
   modules.
     _________________________________________________________

Chapter 3. Frequently Asked Questions

   3.1. Where can I find more about OpenSER?
   3.2. Where can I post a question about this module?
   3.3. How can I report a bug?

   3.1. Where can I find more about OpenSER?

   Take a look at http://openser.org/.

   3.2. Where can I post a question about this module?

   First at all check if your question was already answered on
   one of our mailing lists:

     * User Mailing List -
       http://openser.org/cgi-bin/mailman/listinfo/users
     * Developer Mailing List -
       http://openser.org/cgi-bin/mailman/listinfo/devel

   E-mails regarding any stable OpenSER release should be sent to
   <users@openser.org> and e-mails regarding development versions
   should be sent to <devel@openser.org>.

   If you want to keep the mail private, send it to
   <team@openser.org>.

   3.3. How can I report a bug?

   Please follow the guidelines provided at:
   http://sourceforge.net/tracker/?group_id=139143.
