1. LCR Module

Juha Heinanen

   FhG FOKUS

   Copyright © 2003 FhG FOKUS
   Revision History
   Revision $Revision: 1.8.2.2 $ $Date: 2008/06/12 15:37:35 $
     __________________________________________________________________

   1.1. Overview
   1.2. Dependencies
   1.3. Parameters

        1.3.1. db_url (string)
        1.3.2. gw_table (string)
        1.3.3. gw_name_column (string)
        1.3.4. ip_addr_column (string)
        1.3.5. port_column (string)
        1.3.6. uri_scheme_column (string)
        1.3.7. transport_column (string)
        1.3.8. grp_id_column (string)
        1.3.9. lcr_table (string)
        1.3.10. prefix_column (string)
        1.3.11. from_uri_column (string)
        1.3.12. priority_column (string)

   1.4. Functions

1.1. Overview

   Least cost routing (LCR) module implements two related capabilities:
     * LCR may sequentially forward requests to one or more gateways using
       the load_gws and next_gw functions.
     * LCR may sequentially forward contacts if they don't share the
       same qvalues. Use the functions load_contacts and next_contacts to
       access and select a contact.

   Gateway selection is based on caller's RPID URI (if available in
   caller's RPID AVP after authentication) or From URI and user part of
   Request-URI (telephone number). Gateway patterns matching RPID or From
   URI and telephone number are ordered for forwarding purposes as
   follows:
     * According to longest user part match
     * According to priority
     * Randomly

   Each gateway belongs to a gateway group either alone or among other
   gateways. All gateways in a group share the same priority. Gateway and
   routing information is kept in two tables: gw and lcr.

   When a gateway is selected, Request-URI is rewritten with information
   from gw table: URI scheme, prefix, IP address, port, and transport
   protocol. Valid URI scheme values are:
     * NULL = sip
     * 1 = sip
     * 2 = sips.

   If a prefix is specified it will be prepended to the Request-URI user
   part.

   Currently valid transport protocol values are:
     * NULL = none
     * 1 = udp
     * 2 = tcp
     * 3 = tls

   Table lcr contains any prefix to be applied to the user part of
   Request-URI, the From URI, the gateway group id, and the priority. The
   From URI can contain special characters % and _ matching any number of
   any characters and any one character, respectively.

   In addition to gw and lcr tables there is third table gw_grp that is
   used for administrative purposes only. In this table you may map names
   to the gateway group ids.

1.2. Dependencies

   The module depends on the following modules. These modules must be
   loaded before the LCR module
     * tm module
     * mysql module

1.3. Parameters

   Revision History
   Revision $Revision: 1.8.2.2 $ $Date: 2008/06/12 15:37:35 $

1.3.1. db_url (string)

   The URL for accessing the database where the LCR tables reside

   Default value is NULL.

   Example 1. Set db_url parameter
                ...
                modparam("lcr", "db_url", "mysql://ser:pwd@localhost/ser")
                ...

1.3.2. gw_table (string)

   The name of the table containing the list of gateways

   Default value is gw.

   Example 2. Set gw_table parameter
                ...
                modparam("lcr", "gw_table", "mygateways")
                ...

1.3.3. gw_name_column (string)

   The name of the column that contains the actual name of the gateway

   Default value is gw_name.

   Example 3. Set gw_name_column parameter
                ...
                modparam("lcr", "gw_name_column", "Agateway")
                ...

1.3.4. ip_addr_column (string)

   The name of the column that contains the IP address for a specific
   gateway

   Default value is ip_addr.

   Example 4. Set ip_addr_column parameter
                ...
                modparam("lcr", "ip_addr_column", "gatewayIPs")
                ...

1.3.5. port_column (string)

   The name of the column that contains the port number through which this
   gateway communicates

   Default value is port.

   Example 5. Set port_column parameter
                ...
                modparam("lcr", "port_column", "gatewayPort")
                ...

1.3.6. uri_scheme_column (string)

   The name of the column that contains the scheme to be used when
   rewriting the R-URI

   Default value is uri_scheme.

   Example 6. Set uri_scheme_column parameter
                ...
                modparam("lcr", "uri_scheme", "myURIScheme")
                ...

1.3.7. transport_column (string)

   The name of the column that contains the transport to be used when
   contacting a gateway

   Default value is transport.

   Example 7. Set transport_column parameter
                ...
                modparam("lcr", "transport", "mySIPXport")
                ...

1.3.8. grp_id_column (string)

   The name of the column that contains the gateway group ID number

   Default value is grp_id.

   Example 8. Set grp_id_column parameter
                ...
                modparam("lcr", "grp_id_column", "GwyGroups")
                ...

1.3.9. lcr_table (string)

   The name of the column that contains the LCR table

   Default value is lcr.

   Example 9. Set lcr_table parameter
                ...
                modparam("lcr", "lcr_table", "lcr")
                ...

1.3.10. prefix_column (string)

   The name of the column that contains the prefix to be prepended to the
   R-URI user part.

   Default value is prefix.

   Example 10. Set prefix_column parameter
                ...
                modparam("lcr", "prefix_column", "prefix")
                ...

1.3.11. from_uri_column (string)

   The name of the column that contains the From URI which must match in
   order to select this gateway. Note that the values in this column may
   contain wildcard characters as mentioned earlier in this document.

   Default value is from_uri.

   Example 11. Set from_uri_column parameter
                ...
                modparam("lcr", "from_uri_column", "FromURI")
                ...

1.3.12. priority_column (string)

   The name of the column that contains a number indicating the priority
   of this gateway

   Default value is priority.

   Example 12. Set priority_column parameter
                ...
                modparam("lcr", "priority_column", "priority")
                ...

1.4. Functions

   Revision History
   Revision $Revision: 1.8.2.2 $ $Date: 2008/06/12 15:37:35 $
