# Functions

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

`loose_route` usage

    ...
    loose_route();
    ...

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

`strict_route` usage

    ...
    strict_route();
    ...

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

`record_route` usage

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

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

`record_route_preset` usage

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