[sr-dev] git:master:894796f6: nathelper: support filter contacts by server_id

Victor Seva linuxmaniac at torreviejawireless.org
Mon Jul 6 09:03:19 CEST 2015


Module: kamailio
Branch: master
Commit: 894796f6f1fa2d2778ace5c56f58d204ea06efc2
URL: https://github.com/kamailio/kamailio/commit/894796f6f1fa2d2778ace5c56f58d204ea06efc2

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2015-07-04T10:09:06+02:00

nathelper: support filter contacts by server_id

---

Modified: modules/nathelper/nathelper.c

---

Diff:  https://github.com/kamailio/kamailio/commit/894796f6f1fa2d2778ace5c56f58d204ea06efc2.diff
Patch: https://github.com/kamailio/kamailio/commit/894796f6f1fa2d2778ace5c56f58d204ea06efc2.patch

---

diff --git a/modules/nathelper/nathelper.c b/modules/nathelper/nathelper.c
index f6791db..5f20a5f 100644
--- a/modules/nathelper/nathelper.c
+++ b/modules/nathelper/nathelper.c
@@ -358,7 +358,8 @@ static unsigned int raw_ip = 0;
 static unsigned short raw_port = 0;
 static int nh_keepalive_timeout = 0;
 static request_method_t sipping_method_id = 0;
-
+/* filter contacts by server_id */
+static int nh_filter_srvid = 0;
 
 /*0-> disabled, 1 ->enabled*/
 unsigned int *natping_state=0;
@@ -426,6 +427,7 @@ static param_export_t params[] = {
 	{"keepalive_timeout",     INT_PARAM, &nh_keepalive_timeout  },
 	{"udpping_from_path",     INT_PARAM, &udpping_from_path     },
 	{"append_sdp_oldmediaip", INT_PARAM, &sdp_oldmediaip        },
+	{"filter_server_id",      INT_PARAM, &nh_filter_srvid },
 
 	{0, 0, 0}
 };
@@ -2067,6 +2069,7 @@ nh_timer(unsigned int ticks, void *timer_idx)
 	char *path_ip_str = NULL;
 	unsigned int path_ip = 0;
 	unsigned short path_port = 0;
+	int options = 0;
 
 	if((*natping_state) == 0)
 		goto done;
@@ -2079,9 +2082,10 @@ nh_timer(unsigned int ticks, void *timer_idx)
 			goto done;
 		}
 	}
+	if(nh_filter_srvid) options |= GAU_OPT_SERVER_ID;
 	rval = ul.get_all_ucontacts(buf, cblen, (ping_nated_only?ul.nat_flag:0),
 		((unsigned int)(unsigned long)timer_idx)*natping_interval+iteration,
-		natping_processes*natping_interval);
+		natping_processes*natping_interval, options);
 	if (rval<0) {
 		LM_ERR("failed to fetch contacts\n");
 		goto done;
@@ -2097,7 +2101,7 @@ nh_timer(unsigned int ticks, void *timer_idx)
 		}
 		rval = ul.get_all_ucontacts(buf,cblen,(ping_nated_only?ul.nat_flag:0),
 		   ((unsigned int)(unsigned long)timer_idx)*natping_interval+iteration,
-		   natping_processes*natping_interval);
+		   natping_processes*natping_interval, options);
 		if (rval != 0) {
 			pkg_free(buf);
 			goto done;




More information about the sr-dev mailing list