📄 nathelper_user.sgml
字号:
...</programlisting> </example> </section> </section> <section> <title>Exported Functions</title> <section> <title> <function moreinfo="none">fix_nated_contact()</function> </title> <para> Rewrites Contact <acronym>HF</acronym> to contain request's source address:port. </para> <para> This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>fix_nated_contact</function> usage</title> <programlisting format="linespecific">...if (search("User-Agent: Cisco ATA.*") {fix_nated_contact();};...</programlisting> </example> </section> <section> <title> <function moreinfo="none">fix_nated_sdp(flags)</function> <function moreinfo="none">fix_nated_sdp(flags,IP)</function> </title> <para> Alters the SDP information in orer to facilitate NAT traversal. What changes to be performed may be controled via the <quote>flags</quote> paramter. </para> <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem><para> <emphasis>flags</emphasis> - the value may be a bitwise OR of the following flags: </para> <itemizedlist> <listitem> <para><emphasis>0x01</emphasis> - adds <quote>a=direction:active</quote> SDP line; </para> </listitem> <listitem> <para><emphasis>0x02</emphasis> - rewrite media &ip; address (c=) with source address of the message or the provided IP address (the provide IP address take precedence over the source address). </listitem> <listitem> <para><emphasis>0x04</emphasis> - adds <quote>a=nortpproxy:yes</quote> SDP line; </listitem> <listitem> <para><emphasis>0x08</emphasis> - rewrite IP from origin description (o=) with source address of the message or the provided IP address (the provide IP address take precedence over the source address). </listitem> </itemizedlist> </listitem> <listitem><para> <emphasis>IP</emphasis> - IP to be used for rewritting SDP. If not specified, the received signalling IP will be used. The parameter allows pseudo-variables usage.NOTE: For the IP to be used, you need to use 0x02 or 0x08 flags, otherwise it will have no effect. </para> </itemizedlist> <para> This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>fix_nated_sdp</function> usage</title> <programlisting format="linespecific">...if (search("User-Agent: Cisco ATA.*") {fix_nated_sdp("3");};...</programlisting> </example> </section> <section> <title> <function moreinfo="none">force_rtp_proxy()</function> </title> <para> Rewrites &sdp; body to ensure that media is passed through an &rtp; proxy. </para> <para> This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>force_rtp_proxy</function> usage</title> <programlisting format="linespecific">...if (search("User-Agent: Cisco ATA.*") {force_rtp_proxy();};...</programlisting> </example> </section> <section> <title> <function moreinfo="none">force_rtp_proxy(flags)</function> </title> <para> Same as force_rtp_proxy, but forces additional flags. </para> <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem> <para> <emphasis>flags</emphasis> - flags to turn on some features. </para> <itemizedlist> <listitem><para> <emphasis>a</emphasis> - flags that UA from which message is received doesn't support symmetric RTP. </para></listitem> <listitem><para> <emphasis>l</emphasis> - force <quote>lookup</quote>, that is, only rewrite SDP when corresponding session is already exists in the RTP proxy. Only makes sense for SIP requests, replies are always processed in <quote>lookup</quote> mode. </para></listitem> <listitem><para> <emphasis>i</emphasis> - flags that message is received from UA in the LAN (internal network). Only makes sense when RTP proxy is running in the bridge mode. </para></listitem> <listitem><para> <emphasis>e</emphasis> - flags that message is received from UA in the WAN (external network). Only makes sense when RTP proxy is running in the bridge mode. </para></listitem> <listitem><para> <emphasis>f</emphasis> - instructs nathelper to ignore marks inserted by another nathelper in transit to indicate that the session is already goes through another proxy. Allows creating chain of proxies. </para></listitem> <listitem><para> <emphasis>r</emphasis> - flags that IP address in SDP should be trusted. Without this flag, nathelper ignores address in the SDP and uses source address of the SIP message as media address which is passed to the RTP proxy. </para></listitem> <listitem><para> <emphasis>o</emphasis> - flags that IP from the origin description (o=) should be also changed. </para></listitem> <listitem><para> <emphasis>c</emphasis> - flags to change the session-level SDP connection (c=) IP if media-description also includes connection information. </para></listitem> <listitem><para> <emphasis>s</emphasis> - flags to swap creation with confirmation between requests and replies. By default, a request creates the RTP session and a reply confirms it. If swapped, a reply will create the RTP session and a request will confirm it. </para></listitem> </itemizedlist> </listitem> </itemizedlist> <para> This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>force_rtp_proxy</function> usage</title> <programlisting format="linespecific">...if (src_ip=1.2.3.4) {force_rtp_proxy("i");};...</programlisting> </example> </section> <section> <title> <function moreinfo="none">force_rtp_proxy(flags, ip_address)</function> </title> <para> Same as force_rtp_proxy(flags), but it may force a new SDP IP address. </para> <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem><para> <emphasis>flags</emphasis> - flags to turn on some features. </para></listitem> <listitem><para> <emphasis>ip_address</emphasis> - new SDP IP address. </para></listitem> </itemizedlist> <para> This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>force_rtp_proxy</function> usage</title> <programlisting format="linespecific">...if (search("User-Agent: Cisco ATA.*") {force_rtp_proxy("","1.2.3.4");};...</programlisting> </example> </section> <section> <title> <function moreinfo="none">unforce_rtp_proxy()</function> </title> <para> Tears down the RTPProxy session for the current call. </para> <para> This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> <example> <title><function>unforce_rtp_proxy</function> usage</title> <programlisting format="linespecific">...unforce_rtp_proxy();...</programlisting> </example> </section> <section> <title> <function moreinfo="none">add_rcv_param()</function>, <function moreinfo="none">add_rcv_param(flag)</function> </title> <para> Add received parameter to Contact header fields or Contact URI. The parameter will contain URI created from the source IP, port, and protocol of the packet containing the SIP message. The parameter can be then processed by another registrar, this is useful, for example, when replicating register messages using t_replicate function to another registrar. </para> <para>Meaning of the parameters is as follows:</para> <itemizedlist> <listitem><para> <emphasis>flag</emphasis> - flags to indicate if the parameter should be added to Contact URI or Contact header. If the flag is non-zero, the parameter will be added to the Contact URI. If not used or equal to zero, the parameter will go to the Contact header. </para></listitem> </itemizedlist> <para> This function can be used from REQUEST_ROUTE. </para> <example> <title><function>add_rcv_paramer</function> usage</title> <programlisting format="linespecific">...add_rcv_param(); # add the parameter to the Contact header....add_rcv_param("1"); # add the paramter to the Contact URI...</programlisting> </example> </section> <section> <title> <function moreinfo="none">fix_nated_register()</function> </title> <para> The function creates a URI consisting of the source IP, port, and protocol and stores the URI in an Attribute-Value-Pair. The URI will be appended as "received" parameter to Contact in 200 OK and registrar will store it in the user location database. </para> <para> This function can be used from REQUEST_ROUTE. </para> <example> <title><function>fix_nated_register</function> usage</title> <programlisting format="linespecific">...fix_nated_register();...</programlisting> </example> </section> <section> <title> <function>nat_uac_test(flags)</function> </title> <para> Tries to guess if client's request originated behind a nat. The parameter determines what heuristics is used. </para> <para>Meaning of the flags is as follows:</para> <itemizedlist> <listitem><para> <emphasis>1</emphasis> - Contact header field is searched for occurrence of RFC1918 addresses. </para></listitem> <listitem><para> <emphasis>2</emphasis> - the "received" test is used: address in Via is compared against source IP address of signaling </para></listitem> <listitem><para> <emphasis>4</emphasis> - Top Most VIA is searched for occurrence of RFC1918 addresses </para></listitem> <listitem><para> <emphasis>8</emphasis> - SDP is searched for occurrence of RFC1918 addresses </para></listitem> <listitem><para> <emphasis>16</emphasis> - test if the source port is different from the port in Via </para></listitem> </itemizedlist> <para> All flags can be bitwise combined, the test returns true if any of the tests identified a NAT. </para> <para> This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. </para> </section></chapter><!-- Keep this element at the end of the fileLocal Variables:sgml-parent-document: ("nathelper.sgml" "Book" "chapter")End:-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -