How To Randomize your SIP Listening Port

Some circumstances may warrant the use of randomized SIP Listening ports. Such as working around Firewalls with poor NAT Translation.

Changing the listening port effectively changes the port that phones receive SIP traffic on; they will still send to the PBX with a destination port of 5080.

In a normal scenario (restricted cone NAT), all of your phones will listen for SIP traffic on the default SIP Port of 5080; when you have more than two phones on a network, the first will get a public port of 5080, and the second phone will get a randomized public port. Both phones cannot share the same public IP and Port unless there is some kind of ALG. Dynamically changing your device's SIP listening port will prevent your firewall from having to do the port translation. 

Example without Randomized SIP Ports: Phone 1 and Phone 2 use the standard SIP Listening Port of 5080. Phone 1 uses public IP and Port 12.34.56.78:5080, Phone 2 uses public IP and Port 12.34.56.78.1031. The firewall knows that anything received on the WAN IP and port 5080 goes to Phone 1, and anything received at port 1031 goes to Phone 2.

Example with randomized SIP Ports: Phone 1 gets a random SIP Listening port of 2395, Phone 2 gets a random SIP Listening port of 1032. Each of these phones will use these ports on the Public (WAN) side of the firewall if there are no port conflicts. Phone 1 uses public IP and Port 12.34.56.78:2395, Phone 2 uses public IP and Port 12.34.56.78:1032. The firewall knows that anything received on the WAN IP and port of 2395 goes to Phone 1, and anything received at port 1032 goes to Phone 2.

Overrides

The following overrides can be used as Device, Domain or Brand overrides. The variable [[dynamicPort]] will generate a random port for each phone where you apply the override. Also, note that there are no general downsides to using these overrides where they are not needed.

Yealink

sip.listen_port="[[dynamicPort]]"

Polycom

voIpProt.SIP.local.port="[[dynamicPort]]"

Vtech ET/Snom D series

Vtech ET Series and Snom D Series phones utilize random SIP listening ports by default.

Grandstream GXP Series

P40="[[dynamicPort]]"

Fanvil

sip.SIPLocalPort="[[dynamicPort]]"

What situations will random SIP Listening ports help with?

Confirming there is a NAT issue at the firewall requires looking at LAN, and WAN packet captures and seeing how the packets are being delivered. Randomizing SIP Listening ports will help in scenarios where the customer's local firewall prevents normal functioning Registration, BLF, or MWI.