<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<section id="rr.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
    <sectioninfo>
	<revhistory>
	    <revision>
		<revnumber>$Revision: 1.7 $</revnumber>
		<date>$Date: 2006/05/31 23:23:10 $</date>
	    </revision>
	</revhistory>
    </sectioninfo>

    <title>Functions</title>

    <section id="loose_route">
	<title>
	    <function>loose_route()</function>
	</title>
	<para>
	    The function performs loose routing as defined in <ulink
		url="http://www.ietf.org/rfc/rfc3261.txt">RFC3261</ulink> and
		will set Avp value passed in Route header that were created by <function>record_route</function>.
		If <emphasis>ftag!=tag.from</emphasis> then from/to are flipped.
	</para>
	<example>
	    <title><function>loose_route</function> usage</title>
	    <programlisting>
...
loose_route();
...
	    </programlisting>
	</example>
    </section>

    <section id="strict_route">
	<title>
	    <function>strict_route()</function> -- deprecated
	</title>
	<para>
	    If there are any Route <acronym>HFs</acronym> in the message, the
	    function takes the first one, rewrites Request-URI with it's value
	    and removes the first URI from Route <acronym>HFs</acronym>.
	</para>
	<example>
	    <title><function>strict_route</function> usage</title>
	    <programlisting>
...
strict_route();
...
	    </programlisting>
	</example>
    </section>

    <section id="record_route">
	<title>
	    <function>record_route()</function>
	</title>
	<para>
	    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 <function>setavpflag</function>, flag <emphasis>dialog_cookie</emphasis>
	    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.
	</para>
	<example>
	    <title><function>record_route</function> usage</title>
	    <programlisting>
avpflags
	dialog_cookie;  # must be declared when used in script
...
setavpflag($cookie, "dialog_cookie");
setavpflag("$f./^dlg_/", "dialog_cookie");
record_route();
...
	    </programlisting>
	</example>
    </section>

    <section id="record_route_preset">
	<title>
	    <function>record_route_preset(string)</function>
	</title>
	<para>
	    This function will put the string into Record-Route, don't use
	    unless you know what you are doing.
	</para>
	<para>Meaning of the parameters is as follows:</para>
	<itemizedlist>
	    <listitem>
		<para>
		    <emphasis>string</emphasis> - String to be inserted into the header field.
		</para>
	    </listitem>
	</itemizedlist>
	<example>
	    <title><function>record_route_preset</function> usage</title>
	    <programlisting>
...
record_route_preset("1.2.3.4:5090");
...
	    </programlisting>
	</example>
    </section>
</section>
