Custom ports for sip in asterisk

I want to know that can i change the sip by default port 5060 to some XXXX which i like . because it is by default and if one just got my ip address he can continuously hit my asterisk server which unwantedly create hits on my server. So is there any way to overcome this as trixbox let us change the port .
Does asterisk allow the same too.

Trixbox is Asterisk.

so does it allow or not . if it is same means that it will allow if yes then please let me know how.
Because today i have faced such issue where some users tried to access my asterisk server. they were not one or two they were in bulk so please let me know how to change the port 5060 to some custom one.

As trixbox is Asterisk and trixbox allows it, Asterisk must allow it.

The local port for incoming packets is set in the general section of sip.conf. The remote port for outgoing packets is set in the individual sections. Look for “Optionally add a port number” in the sample configuration file.

Also make sure that you have allowguest=no, block SIP traffic from all but your known correspondents in your firewall, have strong passwords, or match peers by address, rather than name. Don’t use insecure=…port…

Can we fix a port within which the user can register.As suppose you know my ip address u just start hitting my asterisk and try to get the register .can we fix a port within which registration would be allowed.

Your question can really be answered by a simple google search.

There has been a ton of topics on how to secure Asterisk that is available on public IP addresses. Use the forum search feature and you will find all the answers you need. If you can not do that, do yourself a favor and not run Asterisk on a public IP address. I would not recommend that to any person that does not have enough experience in Asterisk.