📄 dispatcher_user.sgml
字号:
<!-- Module User's Guide --><chapter> <chapterinfo> <revhistory> <revision> <revnumber>$Revision: 1.9 $</revnumber> <date>$Date: 2005/12/18 09:56:28 $</date> </revision> </revhistory> </chapterinfo> <title>User's Guide</title> <section> <title>Overview</title> <para> This modules implements a dispatcher for destination addresses. It computes hashes over parts of the request and selects an address from a destination set. The selected address is used then as outbound proxy. </para> <para> The module can be used as a stateless load balancer, having no guarantee of fair distribution. </para> </section> <section> <title>Dependencies</title> <section> <title>&ser; modules</title> <para> The following modules must be loaded before this module: <itemizedlist> <listitem> <para> <emphasis>none</emphasis>. </para> </listitem> </itemizedlist> </para> </section> <section> <title>External libraries or applications</title> <para> The following libraries or applications must be installed before running &ser; with this module: <itemizedlist> <listitem> <para> <emphasis>none</emphasis>. </para> </listitem> </itemizedlist> </para> </section> </section> <section> <title>Exported Parameters</title> <section> <title><varname>list_file</varname> (string)</title> <para> Path to the file with destination sets. </para> <para> <emphasis> Default value is <quote>/etc/ser/dispatcher.list</quote> or <quote>/usr/local/etc/ser/dispatcher.list</quote>. </emphasis> </para> <example> <title>Set the <quote>list_file</quote> parameter</title> <programlisting format="linespecific">...modparam("dispatcher", "list_file", "/var/run/ser/dispatcher.list")...</programlisting> </example> </section> <section> <title><varname>force_dst</varname> (int)</title> <para> If set to 1, force overwriting of destination address when that is already set. </para> <para> <emphasis> Default value is <quote>0</quote>. </emphasis> </para> <example> <title>Set the <quote>force_dst</quote> parameter</title><programlisting format="linespecific">...modparam("dispatcher", "force_dst", 1)...</programlisting> </example> </section> <section> <title><varname>flags</varname> (int)</title> <para> Various flags that affect dispatcher's behaviour. The flags are defined as a bitmask on an integer value. If flag 1 is set only the username part of the uri will be used when computing an uri based hash. If no flags are set the username, hostname and port will be used The port is used only if different from 5060 (normal sip uri) or 5061 (in the sips case). </para> <para> If flag 2 is set, then the failover support is enabled. The functions exported by the module will store the rest of addresses from the destination set in AVP, and use these AVPs to contact next address when the current-tried fails. </para> <para> <emphasis> Default value is <quote>0</quote>. </emphasis> </para> <example> <title>Set the <quote>flags</quote> parameter</title> <programlisting format="linespecific"> ... modparam("dispatcher", "flags", 3) ... </programlisting> </example> </section> <section> <title><varname>use_default</varname> (int)</title> <para> If the parameter is set to 1, the last address in destination set is used as last option to send the message. For example, it is good when wanting to send the call to an anouncement server saying: "the gateways are full, try later". </para> <para> <emphasis> Default value is <quote>0</quote>. </emphasis> </para> <example> <title>Set the <quote>use_default</quote> parameter</title> <programlisting format="linespecific"> ... modparam("dispatcher", "use_default", 1) ... </programlisting> </example> </section> <section> <title><varname>dst_avp_id</varname> (int)</title> <para> The id of the avp which will hold the list with addresses, in the order they have been selected by the chosen algorithm. If use_default is 1, the value of last dst_avp_id is the last address in destination set. The first dst_avp_id is the selected destinations. All the other addresses from the destination set will be added in the avp list to be able to implement serial forking. </para> <para> <emphasis> Default value is <quote>271</quote>. </emphasis> </para> <example> <title>Set the <quote>dst_avp_id</quote> parameter</title> <programlisting format="linespecific"> ... modparam("dispatcher", "dst_avp_id", 100) ... </programlisting> </example> </section> <section> <title><varname>grp_avp_id</varname> (int)</title> <para> The id of the avp storing the group id of the destination set. Good to have it for later usage or checks. </para> <para> <emphasis> Default value is <quote>272</quote>. </emphasis> </para> <example> <title>Set the <quote>grp_avp_id</quote> parameter</title> <programlisting format="linespecific"> ... modparam("dispatcher", "grp_avp_id", 101) ... </programlisting> </example> </section> <section> <title><varname>cnt_avp_id</varname> (int)</title> <para> The id of the avp storing the number of destination addresses kept in dst_avp_id avps. </para> <para> <emphasis> Default value is <quote>273</quote>. </emphasis> </para> <example> <title>Set the <quote>cnt_avp_id</quote> parameter</title> <programlisting format="linespecific"> ... modparam("dispatcher", "cnt_avp_id", 103) ... </programlisting> </example> </section> </section> <section> <title>Exported Functions</title> <section> <title> <function moreinfo="none">ds_select_dst(set, alg)</function> </title> <para> The method selects a destination from addresses set. <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem> <para> <emphasis>set</emphasis> - the id of the set from where to pick up destination address. It is the first column in destination list file. </para> </listitem> <listitem> <para> <emphasis>alg</emphasis> - the algorithm used to select the destination address. </para> <itemizedlist> <listitem> <para> <quote>0</quote> - hash over callid </para> </listitem> <listitem> <para> <quote>1</quote> - hash over from uri. </para> </listitem> <listitem> <para> <quote>2</quote> - hash over to uri. </para> </listitem> <listitem> <para> <quote>3</quote> - hash over request-uri. </para> </listitem> <listitem> <para> <quote>4</quote> - round-robin (next destination). </para> </listitem> <listitem> <para> <quote>X</quote> - if the algorithm is not implemented, the first entry in set is chosen. </para> </listitem> </itemizedlist> </listitem> </itemizedlist> <para> If the bit 2 in 'flags' is set, the rest of the addresses from the destination set is stored in AVP list. You can use 'ds_next_dst()' to use next address to achieve serial forking to all possible destinations. </para> <para> This function can be used from REQUEST_ROUTE. </para> <example> <title><function>ds_select_dst</function> usage</title> <programlisting format="linespecific">...ds_select_dst("1", "0");...</programlisting> </example> </section> <section> <title> <function moreinfo="none">ds_select_domain(set, alg)</function> </title> <para> The method selects a destination from addresses set and rewrites the host and port from R-URI. The parameters have same meaning as for ds_select_dst(). <para> <para> If the bit 2 in 'flags' is set, the rest of the addresses from the destination set is stored in AVP list. You can use 'ds_next_domain()' to use next address to achieve serial forking to all possible destinations. </para> <para> This function can be used from REQUEST_ROUTE. </para> </section> <section> <title> <function moreinfo="none">ds_next_dst()</function> </title> <para> Takes the next destination address from the AVPs with id 'dst_avp_id' and sets the dst_uri (outbound proxy address). </para> <para> This function can be used from FAILURE_ROUTE. </para> </section> <section> <title> <function moreinfo="none">ds_next_domain()</function> </title> <para> Takes the next destination address from the AVPs with id 'dst_avp_id' and sets the domain part of the request uri. </para> <para> This function can be used from FAILURE_ROUTE. </para> </section> <section> <title> <function moreinfo="none">ds_mark_dst()</function> </title> <para> Mark the last used address from destination set as inactive, in order to be ingnored in the future. In this way it can be implemented an automatic detection of failed gateways. When an address is marked as inactive, it will be ignored by 'ds_select_dst' and 'ds_select_domain'. </para> <para> This function can be used from FAILURE_ROUTE. </para> </section> </section> <section> <title>Installation & Running</title> <section> <title>Destination List File</title> <para> Each destination point must be on one line. First token is the set id and next is destination address. The set id must be an integer value. Destination address must be a valid SIP URI. Empty lines or lines starting with <quote>#</quote> are ignored. </para> <example> <title>dispatcher list file</title> <programlisting format="linespecific">...&dispatcherlist;...</programlisting> </example> </section> <section> <title>&ser; config file</title> <para> Next picture displays a sample usage of dispatcher. </para> <example> <title>&ser; config script - sample dispatcher usage</title> <programlisting format="linespecific">...&dispatchercfg;... </programlisting> </example> </section> </section></chapter><!-- Keep this element at the end of the fileLocal Variables:sgml-parent-document: ("dispatcher.sgml" "Book" "chapter")End:-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -