When deploying endpoints behind NATs it is important to ensure that the NAT mapping for external port and IP address continues to stay open so that the endpoint can receive incoming unsolicited packets. Depending on the NAT implementation in use this traffic may need to occur often to keep the mapping open due to a short expiration time. Traditionally this has been done by 1 of 2 methods.
The qualify option configures chan_sip to send an OPTIONS packet to the endpoint and wait for a result. This actually serves two purposes, one being to keep the NAT mapping open and the other being to ensure the device is still reachable. In an environment with a large number of endpoints this can place a large burden on chan_sip as it has to create a dialog for each request, retransmit if needed, and wait for the response. It can also place a burden on the endpoint because it has to parse the SIP packet and respond accordingly.
Many endpoints are capable of being configured to send a keep alive packet to the SIP server it has been configured to register to. While this does work to keep the NAT mapping open it does require additional configuration within the endpoint.
Lightweight NAT Keepalive (new)
A new option is being implemented that uses a lightweight keep alive method to keep the NAT mapping open. Instead of creating a SIP dialog to send an OPTIONS packet out on a very small packet is sent containing only a carriage return. By doing so the burden placed upon both chan_sip and the endpoint is reduced while still allowing the NAT mapping to stay open. Note that this method does NOT provide the ability to confirm that the remote endpoint is still reachable and responding.
The new lightweight keep alive method will be configured using the 'keepalive' configuration option. Valid values will include 'yes', 'no', and the number of seconds in between keep alive packets. If 'yes' is used the interval will be 60 seconds.
A new scheduled item will be created that is very much like the OPTIONS function except it will send the small packet to the endpoint. Reloading configuration will remove the scheduled item if present and schedule a new one at the proper interval if configured.