Where to convert FreePBX to use TCP only as a transport?
Asterisk SIP settings?
In trunk and make sure extensions are set to auto or TCP?
Forwarding ports?
Why am I asking?
I’m having some intermittent issues with incoming calls from the SIP trunk provider, only one is affected and I have few. All looks okay on FreePBX or on the SIP site. They recommended me switch to TCP and suspect issues might be MTU sizes.
There are several issues here and it is unlikely that switching to TCP will fix … well it probably will bodge around it with TCP’s ability to work out MSS - I think its called window scaling.
Your best bet is to look at MTU. A quick test is to set the MTU on your PBX to say 1400 bytes which should work in most places. To do this on the fly:
# ip a
That will list all your network interfaces. Find the one which is your “network card” - it’s name will probably start with en or be called eth0
Change the MTU like this. This example uses eth0 but yours may be something else:
# ip link set dev eth0 mtu 1400
Test. If it fixes the problem you could either stick with 1400 or do a binary search between 1400 and 1500 in steps of four. ie try 1452 which is divisible by four, then whatever is roughly halfway between 1452 and 1500 etc until it fails, then step backwards until you find the correct value.
Asterisk is happy to do SIP and RTP and it is actually RTP that you are worried about over TCP or UDP or any other transport you care to name. You can force your outgoing protocol. Hopefully your registration will cause the other end to switch to your choice because you say it is incoming calls that you have problems with and that means the other end - your provider - needs to make the change.
What several issues are you referring to? There’s one, intermittent problems with incoming calls from a SIP provider. There are various reasons as to why this could be happening, none of which are MTU.
You have nothing to base this statement off of. If there is NAT involved, for example, the router/modem may not be keeping the UDP NAT rule open and thus cause issues with inbound calls. Switching to TCP can solve that as TCP NAT cache is stateful and is kept longer.
Linux systems have a default MTU of 1500, while the OP did say the provider might think it’s an MTU issue they didn’t elaborate on if it was do to the MTU being too small or what the actual MTU issue is. They said it might be an MTU issue. Suggesting to lower the MTU without any real data to work from is throwing pasta on the wall.
I think you are mixing this up with path MTU discovery. That works by sending with Do Not Fragment set, at the network layer, and relies on people not being overzealous with ICMP blocking.
There is a thread on the Asterisk forum where someone is experiencing problems because of UDP fragmentation and a firewall that only lets through the initial fragments, although I’m surprised that MTU is being exceeded in their case:
Reducing the interface MTU may help if you have an ICMP blocking system, but won’t help if only the first fragment gets through.
Been caught up with work projects. Now I can look at this again.
The issue is hard to reproduce, as of the time I’m typing this post it didn’t happen for some time.
When it does happen, the incoming calls do not arrive for a number of calls. Sometimes if I call myself from the landline, it magically fixes and then it may work okay for the rest of the day. I usually spot this problem in the mornings.
My PBX is behind the firewall and NAT. My PBX version is 16.0.40.11(didn’t migrate to 17 yet), my edge is Pfsense CE, latest. The subnet is on Cisco switch where PBX is.
I haven’t done any captures yet of the sip flow.
This only happens with one trunk. It’s Telnyx.
I’m registered for an external trunk that has my DID.
Let me know if I need to post some packets for some detailed analysis.
Do I also need to switch in the asterisk module and per extensions? But I think it set to auto anyway. And also do I need to switch on the NAT rules too?
You need to go to firewall, nat, outbound and select hybrid outbound nat rule generation and then create a mapping for your FreePBX server IP, of your server is indeed behind NAT
I’ve switched to TCP in the Asterisk, trunks and NAT rules. So far so good, calls coming even faster when I dial from my cell (not sure if it’s subjective).