Преглед на файлове

nathelper: it doesn't ping contacts if ping_nated_only=0

- nathelper sends ping only if nat flag is specified, but if ping_nated_only=0 it should ping all contact in any case.
Konstantin Poliakov преди 7 години
родител
ревизия
b34cf58a3a
променени са 1 файла, в които са добавени 3 реда и са изтрити 4 реда
  1. 3 4
      src/modules/nathelper/nathelper.c

+ 3 - 4
src/modules/nathelper/nathelper.c

@@ -2059,10 +2059,9 @@ static void nh_timer(unsigned int ticks, void *timer_idx)
 		dst.proto = PROTO_UDP;
 		dst.send_sock = send_sock;
 
-		if((flags & sipping_flag) != 0
-				&& (opt.s = build_sipping(
-							&c, send_sock, &path, &ruid, aorhash, &opt.len))
-						   != 0) {
+		int should_send_ping = (flags & sipping_flag) != 0 || ping_nated_only == 0;
+
+		if ( should_send_ping && (opt.s = build_sipping(&c, send_sock, &path, &ruid, aorhash, &opt.len)) != 0) {
 			if(udp_send(&dst, opt.s, opt.len) < 0) {
 				LM_ERR("sip udp_send failed\n");
 			}