LCR Module

Juha Heinanen

FhG FOKUS
Revision History
Revision $Revision: 1.1 $$Date: 2006/12/11 18:52:26 $

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 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.

Dependencies

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

  • tm module
  • mysql module

Parameters

Revision History
Revision $Revision: 1.1 $$Date: 2006/12/11 18:52:26 $

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

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") 
		...
	    

Functions

Revision History
Revision $Revision: 1.1 $$Date: 2006/12/12 11:05:00 $