From 0fb0094b2e4be6638bce51872f1b4aa6d5438c2d Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Mon, 8 Jan 2024 16:48:27 +0200 Subject: [PATCH] nathelper: Improve nat_uac_test() docs The function involves neither trying nor guessing, it's quite precise. --- modules/nathelper/doc/nathelper_admin.xml | 27 +++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/modules/nathelper/doc/nathelper_admin.xml b/modules/nathelper/doc/nathelper_admin.xml index 2b948a52c64..f29cf474950 100644 --- a/modules/nathelper/doc/nathelper_admin.xml +++ b/modules/nathelper/doc/nathelper_admin.xml @@ -772,16 +772,16 @@ fix_nated_register(); nat_uac_test(flags) - Tries to guess if client's request originated behind a nat. - The parameter determines what heuristics is used. + Determines whether the received SIP message originated behind a NAT, + using one or more pre-defined checks. - Meaning of the flags (string) parameter - is as follows: + The flags (string) parameter denotes a + comma-separated list of checks to be performed, as follows: private-contact - (old 1 flag) Contact header field is searched for occurrence of RFC1918 / RFC6598 - addresses. + addresses diff-ip-src-via - (old 2 flag) @@ -812,17 +812,26 @@ fix_nated_register(); carrier-grade-nat - (old 128 flag) also include RFC 6333 addresses in the checks for - ct, via and - sdp flags. + Contact, Via and + SDP - A CSV of the above flags can be provided, the test returns true if any of - the tests identified a NAT. + Returns true if any of the tests passed. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. + + <function>nat_uac_test</function> usage + +... +# check for private Contact or SDP media IP addresses +if (nat_uac_test("private-contact,private-sdp")) + xlog("SIP message is NAT'ed (Call-ID: $ci)\n"); +... + +