diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c index 935c981ee8f..953384265a7 100644 --- a/src/modules/nathelper/nathelper.c +++ b/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"); }