Skip to content

Commit 0fb0094

Browse files
committed
nathelper: Improve nat_uac_test() docs
The function involves neither trying nor guessing, it's quite precise.
1 parent 52f2be1 commit 0fb0094

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

modules/nathelper/doc/nathelper_admin.xml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -772,16 +772,16 @@ fix_nated_register();
772772
<function>nat_uac_test(flags)</function>
773773
</title>
774774
<para>
775-
Tries to guess if client's request originated behind a nat.
776-
The parameter determines what heuristics is used.
775+
Determines whether the received SIP message originated behind a NAT,
776+
using one or more pre-defined checks.
777777
</para>
778-
<para>Meaning of the <emphasis>flags (string)</emphasis> parameter
779-
is as follows:</para>
778+
<para>The <emphasis>flags</emphasis> (string) parameter denotes a
779+
comma-separated list of checks to be performed, as follows:</para>
780780
<itemizedlist>
781781
<listitem><para>
782782
<emphasis>private-contact</emphasis> - (old <emphasis>1</emphasis> flag)
783783
Contact header field is searched for occurrence of RFC1918 / RFC6598
784-
addresses.
784+
addresses
785785
</para></listitem>
786786
<listitem><para>
787787
<emphasis>diff-ip-src-via</emphasis> - (old <emphasis>2</emphasis> flag)
@@ -812,17 +812,26 @@ fix_nated_register();
812812
<listitem><para>
813813
<emphasis>carrier-grade-nat</emphasis> - (old <emphasis>128</emphasis>
814814
flag) also include RFC 6333 addresses in the checks for
815-
<emphasis>ct</emphasis>, <emphasis>via</emphasis> and
816-
<emphasis>sdp</emphasis> flags.
815+
<emphasis>Contact</emphasis>, <emphasis>Via</emphasis> and
816+
<emphasis>SDP</emphasis>
817817
</para></listitem>
818818
</itemizedlist>
819819
<para>
820-
A CSV of the above flags can be provided, the test returns true if any of
821-
the tests identified a NAT.
820+
<emphasis role='bold'>Returns true if any of the tests passed</emphasis>.
822821
</para>
823822
<para>
824823
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
825824
</para>
825+
<example>
826+
<title><function>nat_uac_test</function> usage</title>
827+
<programlisting format="linespecific">
828+
...
829+
# check for private Contact or SDP media IP addresses
830+
if (nat_uac_test("private-contact,private-sdp"))
831+
xlog("SIP message is NAT'ed (Call-ID: $ci)\n");
832+
...
833+
</programlisting>
834+
</example>
826835
</section>
827836
</section>
828837

0 commit comments

Comments
 (0)