Does anyone know what could cause the behaviour in the title?
I have a server where it connects to the internet out of an 1 interface on a router, while the (PJSIP) trunk traffic goes through another interface (using a static route in the router), directly to the VoIP provider. The server only has 1 interface.
By Settings - Asterisk SIP Settings, General Settings tab, the external address is set to the external IP of the 2nd router interface. By local address, I have a couple of subnets, including the one the server is in. PJSIP tab, external address matches the one on the general tab, by local address there is only the subnet the server is in, with slash notation.
I had the CHAN_SIP tab set with: NAT-yes, static IP, and the same IP as by the general and PJSIP tabs, but as this behaviour continued, I came to believe it might be some sort of conflict between the PJSIP and CHAN_SIP, so I set the SIP channel driver, by Advanced Settings, to PJSIP, rebooted, then all the CHAN_SIP things disappeared, including the tab by Asterisk SIP Settings.
I thought I was home free, when after the reboot, inspecting the packets across the interface to the provider revealed that it was finally just sending the external IP in the contact-URI… then it spontaneously went back to the internal server IP after working perfectly for a day. I honestly don’t know what to do anymore. Is this a bug or am I missing something?
pjsip.transports.conf looks like this:
[0.0.0.0-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
external_media_address=10.20.30.40
external_signaling_address=10.20.30.40
allow_reload=no
tos=cs3
cos=3
local_net=192.168.1.0/24
local_net=192.168.2.0/24
local_net=192.168.3.0/24
local_net=192.168.1.0/24
The first and last local_net are from the local network on the general tab and PJSIP tab respectively, on the Asterisk SIP Settings page, and are the one that the server itself is in. I tried removing from each page so that it is only listed once in the config file, restarting and trying, but no help.
I want it to stick with saying …@10.20.30.40:5060, but it keeps going back to …@192.168.1.1:5060 in the contact URI… help me, please.
(the IPs are dummies, by the way)