Understand the PBX NAT Settings

Network address translation (NAT) is a method of remapping one IP address space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device. The technique was originally used as a shortcut to avoid the need to readdress every host when a network was moved. It has become a popular and essential tool in conserving global address space in the face of IPv4 address exhaustion. One Internet-routable IP address of a NAT gateway can be used for an entire private network.

mceclip0.png

You can learn about the different types of  NAT in this article: NAT Introduction.

PBX NAT

Scenario

Regarding PBX. The NAT settings work for the SIP packets exclusively. Commonly, when you need to use Remote Extension, the NAT settings are required if your PBX is connected behind the router. If the PBX is directly connected to the public network. It is not necessary to configure NAT.

Refer to the remote extension scenario and settings guide: https://help.yeastar.com/en/s-series/topic/register-a-remote-extension.html

What do the PBX NAT settings do?

What the NAT settings would modify?

Commonly, the 2 types SIP packets we often talk about which would be modified – INVITE and 200 OK. As in practical cases, these 2 types are often involved.

Let’s take the INVITE packet as an example to see which IP address and port of header in the SIP packet would be modified. The 2 headers are the mainly ones we’d encountered with issues in practical cases:

  • Contact Header URI
  • SDP Connection Information IP
mceclip0.png

And 200 OK packet. It is similar.

  • Contact Header URI
  • SDP Connection Information IP
mceclip1.png


While what do the headers do in the SIP calls?

What do the headers do?

Contact Header

The Contact header basically contains the SIP URI of the caller, that the called party can use to send future requests to. That is requests that belong to the same dialog, such as re-INVITE, BYE and ACK messages. In other words, it says where a party can be reached.
Let’s see how Contact is used within particular messages:

During a SIP session establishment process, the caller sends an INVITE, including a Contact header that contains the caller’s URI, informing in this way, the called party about where to send a future BYE request if they decide to release the call or a re-INVITE if they want to re-negotiate the session.

When the recipient receives the initial INVITE, they will process it and eventually send back a 200 OK response. In that 200 OK, the called party has the opportunity to include their own Contact header allowing the caller to know where to send future requests. Particularly, it is necessary for the caller to know the called party’s contact information, in order to send back an ACK which acknowledges/confirms the reception of 200 OK and completes the session establishment.

This ACK message can now travel directly to the recipient bypassing all the proxies on the way.
However, this behavior can be overwritten if the routing configuration or the device specifies otherwise or if a “record-route” header is used (which is added in a request by proxies that want to stay in the SIP path for future request in that dialog).

In the practical cases, the Contact header problem would lead to a common issue of “hangup at about 30 seconds”.

In the following example, the remote extension calls the other extension in the local network.
First to see the duration between answer and hang up is 32 seconds. Usually, the 200 OK in the SIP call represents the answer. BYE, CANCEL packet means to hang up.

PCAP log captured on PBX:

mceclip2.png

As you see, and if know SIP call flow well. You would know the 200 OK packets are abnormal.

Then we find the Contact header IP address in 200 OK is a private IP address. For the remote side, it is not a reachable address on the Internet. So call would be hung up.

mceclip3.png

For more case, you can refer to these articles:

How to Analyze the 30 Seconds Hangup Problem?

Call Hangs up at 30 Seconds

SDP Connection IP

It tells the other party of call where the media (voice packets) should send.

How do the PBX NAT settings work?

Leave a Reply

Your email address will not be published.