About NAT for PJSIP
chan _pjsip is no more NAT aware than chan_sip in terms of nat=*. It simply breaks the sub-options of nat= into fully-fledged options, so that nat=comedia becomes rtp_symmetric=yes and nat=force_rport becomes force_rport=yes. The common incantation of nat=force_rport, comedia is equivalent to specifying both options.
Read more tutorials and guides on how to implement new tools and technologies for your business with VitalPBX.
How to configure NAT for PJSIP Endpoints
With PJSIP, we need to configure NAT settings in two places, first, we need to add our public and local network on the PJSIP Settings module, as shown in the next image:
Finally, we need to edit the default PJSIP profile to enabled the following parameters: Force rport, RTP Symmetric, and Rewrite Contact. Check the picture below:
But, What these parameters mean? Well, here are the definitions of those parameters:
- Force rport (force_rport): Force RFC3581 compliant behavior even when no rport parameter exists. Basically always send SIP responses back to the same port we received SIP requests from.
- RTP Symmetric (rtp_symmetric): Enforce that RTP must be symmetric. Send RTP back to the same address/port we received it from.
- Rewrite Contact (rewrite_contact): Determine whether SIP requests will be sent to the source IP address and port, instead of the address provided by the endpoint.This is a parameter that can be used when the endpoint or phone device sends the private IP on its headers, so, this produces that the endpoint status is “UNREACHABLE”. In these cases, the endpoint can perform calls, but cannot receive calls. Incoming calls are always sent to the endpoint’s voicemail.
And that’s it, with these easy steps, we have enabled NAT using PJSIP. Learn more about VitalPBX, our services and how we can help you achieve your goals in our official website.