1. RR Module

Jan Janak

FhG FOKUS
Revision History
Revision $Revision$ $Date$

1.1. Overview
1.2. Parameters
1.2.1. enable_full_lr (integer)
1.2.2. append_fromtag (integer)
1.2.3. enable_double_rr (integer)
1.2.4. user_part_avp (string)
1.2.5. next_route_avp (string)
1.2.6. cookie_secret (string)
1.2.7. force_send_socket (integer)
1.3. Functions
1.3.1. loose_route()
1.3.2. strict_route() -- deprecated
1.3.3. record_route()
1.3.4. record_route_preset(string)

1.1. Overview

The module contains record routing logic

1.2. Parameters

Revision History
Revision $Revision$ $Date$

1.2.1. enable_full_lr (integer)

If set to 1 then ;lr=on instead of just ;lr will be used. This is to overcome problems with broken UAs which strip ;lr parameter when generating Route header fields from Record-Route (;lr=on seems to help).

Default value is 0 (no).

Example 1. Set enable_full_lr parameter

...
modparam("rr", "enable_full_lr", 1)
...

1.2.2. append_fromtag (integer)

if turned on, request's from-tag is appended to record-route; that's useful for understanding whether subsequent requests (such as BYE) come from caller (route's from-tag==BYE's from-tag) or callee (route's from-tag==BYE's to-tag)

Default value is 1 (yes).

Example 2. Set append_fromtag parameter

...
modparam("rr", "append_fromtag", 0)
...

1.2.3. enable_double_rr (integer)

There are some situations when the server needs to insert two Record-Route header fields instead of one. For example when using two disconnected networks or doing cross-protocol forwarding from UDP->TCP. This parameter enables inserting of 2 Record-Routes. The server will later remove both of them.

Default value is 1 (yes).

Example 3. Set enable_double_rr parameter

...
modparam("rr", "enable_double_rr", 0)
...

1.2.4. user_part_avp (string)

If this parameter is set, the loose_route call stores the user part of the route URI in the AVP, which is identified by the parameter value. It can be utilized later in the routing script.

Default value is NULL (do not insert user part into avps).

Example 4. Set user_part_avp parameter, later use

...
modparam("rr", "user_part_avp", "route_user")
...
route{
...
	if (loose_route()) {
		t_relay();
	}
	
	if ($route_user == "my_user") {
		...
	}
...
}

1.2.5. next_route_avp (string)

If this parameter is set, the loose_route call stores the URI of the next hop in the AVP, which is identified by the parameter value. It can be then utilized in the routing script.

Default value is NULL (do not insert next route into avps).

Example 5. Set next_route_avp parameter, later use

...
modparam("rr", "next_route_avp", "route_next")
...
route{
...
	loose_route();
	
	if ($route_next=~"101.102.103.1[0-9][0-9]") {
		t_relay();
	}

1.2.6. cookie_secret (string)

Secret to distinguish cookies from different servers.

Default value is empty string.

Example 6. Set cookie_secret parameter, later use

...
modparam("rr", "cookie_secret", "bflmpsvz")
...

1.2.7. force_send_socket (integer)

If set to 1 and two Record-Route headers have been inserted by the proxy before then the outgoing socket is forced by loose_route() to be the address of the second Route header in the in-dialog requests. Useful on multihomed hosts.

Default value is 1 (yes).

Example 7. Set force_send_socket parameter

...
modparam("rr", "force_send_socket", 1)
...

1.3. Functions

Revision History
Revision $Revision$ $Date$

1.3.1.  loose_route()

The function performs loose routing as defined in RFC3261 and will set Avp value passed in Route header that were created by record_route. If ftag!=tag.from then from/to are flipped.

Example 8. loose_route usage

...
loose_route();
...

1.3.2.  strict_route() -- deprecated

If there are any Route HFs in the message, the function takes the first one, rewrites Request-URI with it's value and removes the first URI from Route HFs.

Example 9. strict_route usage

...
strict_route();
...

1.3.3.  record_route()

The function adds a new Record-Route header field. The header field will be inserted in the message before any other Record-Route header fields. Avp marked using setavpflag, flag dialog_cookie will be inserted as serialized parameter of record-route header. Note that only user class AVPs should be passed as cookies, i.e. domain and global should be avoided.

Example 10. record_route usage

avpflags
	dialog_cookie;  # must be declared when used in script
...
setavpflag($cookie, "dialog_cookie");
setavpflag("$f./^dlg_/", "dialog_cookie");
record_route();
...

1.3.4.  record_route_preset(string)

This function will put the string into Record-Route, don't use unless you know what you are doing.

Meaning of the parameters is as follows:

  • string - String to be inserted into the header field.

Example 11. record_route_preset usage

...
record_route_preset("1.2.3.4:5090");
...