Change port 5060 to a non-standard port

Hello Everyone.
I’m running freepbx with purple flavor. Server is running fine, and I can get the phone to register. However I want to change the communication port from 5060 to a non standard port in the allowed range. Can someone please help me changing that?

thanks for the tips, i appreciate it. seems like it works but offers only a range from 5004 to 5082. I’d like to use a port outside the 5xxx range. Is it still possible? wonder if this range is tweakable for the server? any ideas?

Changing Port 5060 is a very good idea if you’re going to make the SIP Signalling port available on the internet. I’ve read reports of bots that scour the internet looking for an open 5060 and then try to brute force its way in.

If you want to change the SIP Signaling Port from the standard 5060, open a command prompt on your server, and type the following:

cd /etc/asterisk
nano sip_general_custom.conf

add the following to the file:


(Change 5060 to your new port).

CTRL-O, ENTER, CTRL-X. (Saves, Exits)

amportal stop
amportal start

You may also be able to add the bindport=xxxx to the Tools- Asterisk SIP Settings module, at the bottom under Other SIP Settings, but I haven’t tried that…

Using hard phones. Taking a look at XLITE, there doesn’t appear to be a way to change the port. The settings to which you refer are the RTP media stream ports. The 5060 port is used to set up the call.

A good explanation of how this works is here:

Again, I haven’t seen a way to set up the sip port in asterisk, only the RTP ports.

what client are you using?

It doesn’t work. I can sniff the traffic and still seeing that request is going out for 5060 port. I have specified port 5004, and provided the range of 5001 to 5060 in the x-lite port range config. Still timing out.
any suggestions?


The only way I know of to change a port is to configure the port on the extension setup, and change the corresponding setting on the phone itself.

It has always worked for me!

May be that you’re using X-Lite free and it doesn’t allow you to change ports. I’ve never used X-lite in a production system and have never been required to change the sip ports.

When you configure an extension, change the default port to what you want, you’ll have to do the same when you configure the associated phone.