Module: kamailio Branch: master Commit: 31c807aaf20dc4c85ed9f1b0d91340b430d60d41 URL: https://github.com/kamailio/kamailio/commit/31c807aaf20dc4c85ed9f1b0d91340b4...
Author: Stefan Mititelu stefan.mititelu@net2phone.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-02-21T08:39:26+01:00
nathelper: Add modparam to not send ping to Path
---
Modified: src/modules/nathelper/doc/nathelper_admin.xml Modified: src/modules/nathelper/nathelper.c
---
Diff: https://github.com/kamailio/kamailio/commit/31c807aaf20dc4c85ed9f1b0d91340b4... Patch: https://github.com/kamailio/kamailio/commit/31c807aaf20dc4c85ed9f1b0d91340b4...
---
diff --git a/src/modules/nathelper/doc/nathelper_admin.xml b/src/modules/nathelper/doc/nathelper_admin.xml index c8b14caea54..9f3e19eed87 100644 --- a/src/modules/nathelper/doc/nathelper_admin.xml +++ b/src/modules/nathelper/doc/nathelper_admin.xml @@ -428,6 +428,26 @@ modparam("nathelper", "udpping_from_path", 1) </programlisting> </example> </section> + <section id="nathelper.p.ignore_path"> + <title><varname>ignore_path</varname> (int)</title> + <para> + Enable ignore of Path header address when sending UDP pings (keepalives). + </para> + <para> + <emphasis> + Default value is <quote>0</quote> (feature disabled). + UDP pings are sent to Path header if header is present. + </emphasis> + </para> + <example> + <title>Set <varname>ignore_path</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("nathelper", "ignore_path", 1) +... + </programlisting> + </example> + </section> <section id="nathelper.p.append_sdp_oldmediaip"> <title><varname>append_sdp_oldmediaip</varname> (int)</title> <para> diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c index ec543079f31..b3335960fbd 100644 --- a/src/modules/nathelper/nathelper.c +++ b/src/modules/nathelper/nathelper.c @@ -193,6 +193,7 @@ static avp_name_t rcv_avp_name;
static char *natping_socket = NULL; static int udpping_from_path = 0; +static int ignore_path = 0; static int sdp_oldmediaip = 1; static int raw_sock = -1; static unsigned int raw_ip = 0; @@ -277,6 +278,7 @@ static param_export_t params[] = { {"natping_socket", PARAM_STRING, &natping_socket }, {"keepalive_timeout", PARAM_INT, &nh_keepalive_timeout }, {"udpping_from_path", PARAM_INT, &udpping_from_path }, + {"ignore_path", PARAM_INT, &ignore_path}, {"append_sdp_oldmediaip", PARAM_INT, &sdp_oldmediaip }, {"filter_server_id", PARAM_INT, &nh_filter_srvid }, {"nat_addr_mode", PARAM_INT, &nh_nat_addr_mode }, @@ -2387,7 +2389,7 @@ static void nh_timer(unsigned int ticks, void *timer_idx) dst_uri = &c;
/* determine the destination */ - if(path.len && (flags & sipping_flag) != 0) { + if(path.len && (flags & sipping_flag) != 0 && !ignore_path) { /* send to first URI in path */ if(get_path_dst_uri(&path, &opt) < 0) { LM_ERR("failed to get dst_uri for Path\n"); @@ -2398,7 +2400,7 @@ static void nh_timer(unsigned int ticks, void *timer_idx) LM_ERR("can't parse contact dst_uri\n"); continue; } - } else if(path.len && udpping_from_path) { + } else if(path.len && udpping_from_path && !ignore_path) { path_ip_str = extract_last_path_ip(path); if(path_ip_str == NULL) { LM_ERR("unable to parse path from location\n");