SDP and Contact returning LAN IP on inbound calls

Hi guys,

I’ve been away from Asterisk for a while and I’m new to Asterisk 13.11.2. I’ve got a server that is sitting behind NAT with phones on the network and a Level3 SIP trunk going out. I’ve got nat=force_rport,comedia and my externip & localnet set but it’s still showing up with the LAN IP in the headers. Outbound calls work fine and I can get the RTP stream on an inbound call if I’ve recently made an outbound call but if I haven’t made a call in a while, RTP will start going back to the LAN IP (I’m guessing that’s maybe a reinvite behavior). I have some old 10.x Asterisk servers with the same setup mostly that work fine. Is there something I’m missing? Below is my sip_general_additional.conf I also have the sip debug output if that would help.

accept_outofcall_message=yes
auth_message_requests=no
outofcall_message_context=dpma_message_context
faxdetect=no
vmexten=*97
useragent=FPBX-13.0.188.13(13.11.2)
disallow=all
allow=ulaw
allow=g729
allow=alaw
allow=gsm
context=from-sip-external
callerid=Unknown
notifyringing=yes
notifyhold=yes
tos_sip=cs3
tos_audio=ef
tos_video=af41
alwaysauthreject=yes
limitonpeers=yes
insecure=invite
progressinband=yes
rtpend=20000
rtpstart=10000
context=from-sip-external
callevents=yes
tcpenable=no
bindport=5060
jbenable=no
tlsbindaddr=[::]:5061
notifyhold=yes
tlsclientmethod=sslv2
tlsenable=no
srvlookup=no
allowguest=yes
defaultexpiry=120
minexpiry=60
rtptimeout=30
g726nonstandard=no
videosupport=no
maxcallbitrate=384
canreinvite=no
registerattempts=4
maxexpiry=3600
registertimeout=20
notifyringing=yes
checkmwi=10
rtpkeepalive=4
rtpholdtimeout=300
nat=force_rport,comedia
ALLOW_SIP_ANON=no
callerid=Unknown
externip=62.187.77.77
localnet=172.20.0.0/255.255.0.0
localnet=172.20.49.0/255.255.255.0
localnet=10.0.0.0/255.0.0.0
localnet=172.20.48.0/24
language=en

I’d suggest providing the output of “sip set debug on” with a call that exhibits the problem so we can’t see what is actually going over the wire. The output of “rtp set debug on” would also help.