PBX cannot re-register with the SIP trunk, after connection loss
Description:
I am using an Asterisk based PBX behind a Microtik RB3011UiAS. The PBX connects to a SIP trunk. Every 24 hours we have a forced disconnection of the internet connection. After the forced disconnection, the PBX tries to log on to the SIP trunk again. The PBX sends packets to the SIP trunk, but there are no response packets in the RouterBoard. A new connection can only be established after restarting the RouterBoard, disconnecting the PBX connection or changing the SIP port.
Versions affected:
6.39.3, 6.40.4, 6.40.5 tested
How to reproduce:
1) Establish Internet connection via PPPoE
2) Register Asterisk based PBX (e.g. FreePBX) to SIP trunk
3) Disable PPPoE interface and wait a few seconds
4) Enable PPPoE interface
Network setup:
+----------------+ +---------------+ +------------+ +-------------+
| PBX | ether6 | RB3011UiAS | ether1 | VDSL modem | Internet | SIP trunk |
| 192.168.111.79 |----------| 192.168.111.1 |----------| 10.0.0.1 |------------| 95.128.80.5 |
+----------------+ +---------------+ +------------+ +-------------+
/ip firewall filter
add action=accept chain=input comment="accept ICMP" protocol=icmp
add action=accept chain=input comment="accept established,related" connection-state=established,related
add action=accept chain=input comment="OpenVPN remote connection" dst-port=443 in-interface=pppoe-telekom protocol=tcp
add action=drop chain=input comment="drop all from WAN" in-interface=pppoe-telekom
add action=fasttrack-connection chain=forward comment=fasttrack connection-state=established,related
add action=accept chain=forward comment="accept established,related" connection-state=established,related
add action=reject chain=forward comment="reject connection from guest to office lan" in-interface=bridge_guest out-interface=!pppoe-telekom reject-with=icmp-admin-prohibited
add action=drop chain=forward comment="drop invalid connection" connection-state=invalid
add action=drop chain=forward comment="drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface=pppoe-telekom
/ip firewall nat
add action=masquerade chain=srcnat comment="masquerade wan1" out-interface=pppoe-telekom
[admin@router01] /ip firewall connection> print where src-address~"192.168.111.79:5060"
Flags: E - expected, S - seen-reply, A - assured, C - confirmed, D - dying, F - fasttrack, s - srcnat, d - dstnat
# PROTOCOL SRC-ADDRESS DST-ADDRESS TCP-STATE TIMEOUT ORIG-RATE REPL-RATE ORIG-PACKETS REPL-PACKETS ORIG-BYTES REPL-BYTES
0 SAC Fs udp 192.168.111.79:5060 95.128.80.5:5060 2m57s 0bps 0bps 1 3 588 1 067
[admin@router01] /ip firewall connection> print where src-address~"192.168.111.79:5060"
Flags: E - expected, S - seen-reply, A - assured, C - confirmed, D - dying, F - fasttrack, s - srcnat, d - dstnat
# PROTOCOL SRC-ADDRESS DST-ADDRESS TCP-STATE TIMEOUT ORIG-RATE REPL-RATE ORIG-PACKETS REPL-PACKETS ORIG-BYTES REPL-BYTES
0 C s udp 192.168.111.79:5060 95.128.80.5:5060 58s 9.4kbps 0bps 5 0 2 940 0
There seems to be a problem with NAT, because after restarting the RouterBoard or changing the port, the connection is immediately reestablished. Deleting the connection from the connection tracking does not solve the problem.
Support TicketID:
Ticket#2017112222000777
Best regards,
Stefan