Hi, all. I am new to FreePBX and PBX administration in general, so please forgive me.
I have been tasked with moving a (working) FreePBX/Asterisk PBX from direct internet to behind a NAT firewall (I know. But I have no choice).
I have it to where everything works…sometimes. Outbound calls from PBX extensions to PSTN numbers over a Twilio trunk work fine. Inbound DID calls work only some of the time.
When they succeed, the log reflects “Found peer ‘firewall-trunk-incoming’ for ‘+1calling number’ from 172.16.2.1:5060”
When they fail, the log reflects “Rejecting unknown SIP connection from 172.16.2.1”
172.16.2.1 is the interior IP of my firewall. I have a trunk set up in FreePBX with 172.16.2.1 set as a peer on the inbound side, and clearly the port forwarding on the firewall is letting stuff through.
What I don’t understand is why two calls, from the same PSTN phone, across the same trunk, across the same firewall, getting to the PBX from the same IP, are rejected as “unknown” some of the time, but accepted as a peer at other times. I can call twice from the same phone, literally ten seconds apart, and one will go through and reach the extension, and one will reject with “The number you have dialed is not in service”.