Tech

SIP Gateway behind NAT

Published on:

October 4, 2013

Network Address Translation (NAT) was a workaround for the limited IPv4 addresses, and SIP was designed to be NAT-unfriendly to encourage IPv6 adoption. As IPv6 remains far from mainstream, however, NAT is still a challenge. The Vodia PBX addresses this with a "mini-session border controller" that detects non-routable IPs and ignores SIP routing information. This solution works well with endpoints, but it faces issues with gateways behind NAT. The upcoming version, 5.1.3, introduces a trunk flag to prevent the PBX from updating the SIP route, allowing for better communication. This also simplifies gateway registration, offering a more stable NAT workaround until IPv6 becomes common.

Network Address Translation (NAT) was a hack becasue most of us just get one IPv4 IP address from our provider. SIP was purposely defined NAT-unfriendly to promote the use of IPv6 networks. While we have been waiting for IPv6 to become mainstream for more than a decade now, we have to deal with this reality.

For the SIP phones the Vodia PBX has a logic we call a “mini-session border controller”. It detects when a device runs on a network address that's not routable and then ignores the SIP routing information in it. While this makes our life easier with endpoints, we recently found out life isn't so simple with gateways if they are behind NAT. Here is the setup:

A PSTN gateway runs on a private IP address. On the firewall, the SIP port was forwarded to the private IP address of the gateway so the PBX can send SIP INVITE to the gateway. On the gateway, the outbound proxy is set to the PBX, which runs on a public IP (e.g., on a hosted PBX like the one on our http://hostedi.am).

The problem is this: when the PBX sends an INVITE to the gateway, the gateway responds with its private IP address in the routing headers. In SIP, the UAC (the PBX) is supposed to update the routing information, and there the communication breaks. The PBX can't send the ACK request to the gateway, and the call setup eventually times out.The solution we will introduce in version 5.1.3 is another trunk flag. It will have the name “Don't accept SIP routing changes in dialog” and it does what it's name says: when the PBX receives a response, it sticks to the original destination and doesn't update the route. Because the PBX advertises an address for the media that's routable for the gateway, it will start receiving media from the gateway, and that’s where it sends the media back. Fortunately, most gateways did not follow the IETF proposal to use different ports for sending and receiving, so this also works when the gateway is behind NAT.

This new setting has the potential to render the dial plan feature to send calls to a registered extension obsolete. Instead of registering the gateway to the PBX, the firewall just needs to forward the requests to UDP port 5060 to the gateway. Of course, other ports than 5060 can be easily used. If the public IP address of the local network keeps changing, services like dyndns can help directing the PBX to the right location.

Another workaround for NAT. I can’t wait until IPv6 becomes widely available.

Derniers articles

Voir tous

How the Hospitality Industry Can Exceed Guest Expectations

As hotels prepare for the upcoming travel season, many are rethinking their communication systems to better meet modern guest expectations. Vodia CEO Dr. Christian Stredicke explains how VoIP, AI, and app-based control are key to delivering smarter, more personalized service. Guests now expect mobile-first experiences—whether for check-in, room controls, or contacting hotel staff. Vodia’s customizable communication solutions help hotels automate tasks, streamline operations, and boost guest comfort while reducing costs. With robust security and seamless integration into existing hotel management systems, Vodia enables hotels to move beyond outdated hardware and deliver the connected, high-quality experience today’s travelers demand.

April 23, 2025

Seatrade Cruise Global 2025: Communications Revolution Onboard - What Cruise Experts Need to Know

At Seatrade’s 40th anniversary, Vodia and Lufthansa Industry Solutions showcased the Vodia Maritime Communication Server and the new CruisR World App—purpose-built for next-generation cruise ships and cost-effective retrofits. Key themes at the event included AI-powered language translation, breakthrough satellite connectivity, UC platforms, and advanced emergency protocols. These innovations enable cruise lines to streamline operations, personalize guest experiences, and meet growing expectations for safety and connectivity. As the cruise industry evolves, Vodia’s solutions position communication teams to lead with smarter, more human-centric technology at sea.

April 23, 2025

Christian Stredicke Discusses the Future of AI in Business Communications on the Technology Reseller News Podcast

Vodia CEO Christian Stredicke recently joined Technology Reseller News to discuss how AI is reshaping business communications. With the release of Vodia PBX version 69.5.6, features like real-time OpenAI integration and call transcription via Whisper are setting the stage for voice-driven interactions—replacing complex phone menus with simple spoken commands. Christian emphasized Vodia’s goal of using AI to improve productivity and customer experience, while recognizing the importance of tailoring AI applications to specific industries. He likened today’s AI shift to the early days of the web, where expert guidance is key to successful adoption.

April 3, 2025