Incoming Calls From VOIP Provider Come from Router IP

FreePBX Distro: 13.0.58
I have setup an incoming trunk to receive calls from one of my VOIP providers.
When the call comes in, Asterisk reports that the call is from my router:
“Rejecting unknown SIP connection from 192.168.1.1”

If I put the IP address of my router in my trunk config or configure FreePBX to allow anonymous calls, then incoming calls are successful.

I am not sure why FreePBX thinks the call is coming from router and not the VOIP provider.
I have looked at my router config and it seems normal and must be working otherwise calls wouldn’t route properly when I specifically allow 192.168.1.1 in my trunk config.

Below is my config with a fictional Public IP.

localnet=192.168.1.0/24
externip=66.66.66.66
ALLOW_SIP_ANON=no

Any ideas on why FreePBX thinks the call is coming from my router?

you don’t want the address of your router in the trunk config. are you using trunk registration or ip authentication on your trunk? what kind of router? do you have sip alg (or whatever the router calls it turned on - it probably needs to be off)

My provider uses IP authentication
Here is my config substituted with a fake IP

type=friend
insecure=invite,port
host=77.77.77.77
dtmfmode=rfc2833
disallow=all
context=from-trunk
allow=ulaw

It is a Mikrotik Router.
I have ALG turned off on it. (/ip firewall service-port disable sip)

that looks correct. you should not have anything in the user context for the trunk. what about the sip settings? you should have your external ip address there and have nat set to yes. who is the sip trunk provider?

I looked closer at the Mikrotik settings and found out someone applied a NAT rule on traffic going out the LAN interface.

That was causing the source IP to get re-written.

I deleted it and now incoming calls are working.

Thanks for the second pair of eyes.