Change port 5060


my config works well on port 5060 and because of attack I would like to change port.
I try to change in sip.config, no firewall, iptables is ok but … no success.

Where I need to change value?


on pjsip use the transport section, on chan_sip dont remeber if using bindaddr with port included will change it, but I think there is a port option too

Thx for reply,
How I can know module I use ?

The configuration for the two is very different, including the file names. You had to know which you were using in order to configure it in the first place.

As @david551 says you should know which module are you using, also on the Asterisk cli you can see the SIP module in place

With CLI:

*CLI> show modules
No such command ‘show modules’ (type ‘core show help show modules’ for other possible commands)

Which information you need ?

Sorry based on initial request I thought you had at least the basic knowledge to determine the chan sip stack in used, IF you can determine that looks like you will need to learn asterisk basic first

Yes, I just discovered the software and if I run on 5060 everything ok

Global Settings:

UDP Bindaddress:
TCP SIP Bindaddress: Disabled
TLS SIP Bindaddress: Disabled
RTP Bindaddress: Disabled

You will have to change the port on ‘other side’ as well, like your desk set and/or your SIP provider.

I did.
I supposed I miss something but where?

Enabling SIP debugging on the Asterisk console or ‘tcpdump’ may yield some clues.

I forget to give this information:
I run on docker:

Here lsof with the config working

root@c89b3b4dc4fb:/src# lsof -i
asterisk 18 root 9u IPv4 6116917 0t0 UDP *:50858
asterisk 18 root 10u IPv6 6116918 0t0 UDP *:49079
asterisk 18 root 12u IPv4 6116919 0t0 UDP *:2727
asterisk 18 root 14u IPv4 6116920 0t0 UDP c89b3b4dc4fb:4569
asterisk 18 root 15u IPv4 6116921 0t0 TCP *:2000 (LISTEN)
asterisk 18 root 17u IPv4 6116923 0t0 UDP *:5060
asterisk 18 root 18u IPv4 6116924 0t0 TCP *:5060 (LISTEN)
asterisk 18 root 19u IPv4 6116928 0t0 UDP *:5000
asterisk 18 root 20u IPv4 6116929 0t0 UDP *:4520

here with 5080 port

lsof -i
asterisk 10 root 9u IPv4 6039720 0t0 UDP *:37031
asterisk 10 root 10u IPv6 6039721 0t0 UDP *:54847
asterisk 10 root 12u IPv4 6039518 0t0 UDP *:2727
asterisk 10 root 14u IPv4 6039519 0t0 UDP ef56c378173c:iax
asterisk 10 root 15u IPv4 6039520 0t0 TCP *:cisco-sccp (LISTEN)
asterisk 10 root 17u IPv4 6039521 0t0 UDP *:5080
asterisk 10 root 18u IPv4 6039723 0t0 UDP *:5000
asterisk 10 root 19u IPv4 6039724 0t0 UDP *:4520

Normally I configure to use only UDP but I see TCP listening, is a clue ?

'module show like sip

Docker reduces the pool of members who have relevant experience – like me :slight_smile: I ran Asterisk in a Docker container years ago but dropped it because the network configuration was too different from the ‘bare metal’ installs I did for my clients. A Virtualbox VM serves my needs better. I never tried changing port numbers.

I’m curious why your 2 ‘lsof’ snippets differ in how port numbers are resolved but the command lines are identical. 'lsof -i -n -P' should provide consistent output.

Tracking down why your port configuration changes caused Asterisk to stop listening on tcp:5060 is curious and suggests you changed something you didn’t intend to. Resolving this mystery may lead to a greater understanding in how to implement your changes.

I’d suggest starting your Asterisk journey with a more ‘main stream’ environment like a VM or a Raspberry PI or a spare PC/laptop if you have one. Once you have your configuration working, then move to Docker.

1 Like