Public IP in contact header despite network set in local networks

I have a VPN network added to local networks in PJSIP and I can call a phone on that network, but in the INVITE that Asterisk sends to that phone, the contact header contains the wrong IP address, i.e. the public IP of the Asterisk server instead of it’s private address. Same with the media address, resulting in one way audio and BYEs being sent to the wrong address.

I don’t understand why that would be happening.

This is the Invite from Asterisk to the phone with the wrong contact IP.

INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 200.123.123.123:5060;rport;branch=z9hG4bKPj5fbb83df-c140-45cc-86f8-f7d6315bc139
From: “Johann T42S” sip:[email protected];tag=79c72b2f-5e27-40a0-8112-6c59bd15d287
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: f709d173-c56f-45f3-822d-15be2095e3fc
CSeq: 30956 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: “Johann T42S” sip:[email protected]
Max-Forwards: 70
User-Agent: FPBX-13.0.195.4(13.18.3)
Content-Type: application/sdp
Content-Length: 421

v=0
o=- 1438095040 1438095040 IN IP4 10.20.32.4
s=Asterisk
c=IN IP4 200.123.123.123
t=0 0
m=audio 14730 RTP/AVP 9 0 18 107 101
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:107 opus/48000/2
a=fmtp:107 sprop-maxcapturerate=16000;maxaveragebitrate=20000;cbr=1;useinbandfec=1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:20
a=sendrecv

Destination network is set in SIP settings:
image

Fixed.
I had added the VPN network to local networks but Asterisk didn’t properly load them because I had allow_reload set to no for the transport, because that would break BLF for me.
Had to temporarily set allow_reload to yes, then reload and now it’s fine.

An asterisk restart after the apply config would do it as well.

So with the default in newer FreePBX versions being allow_reload=no, whenever we make changes to transports and local networks, we need to restart Asterisk (or temporarily set allow_reload=yes like I did above)?

I’ve gotten in the habit of dropping a fwconsole restart when ever I touch something network related.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.