Asterisk port/network issue

Hi,

Using Asterisk 13 with pjsip and Twilio as the sip server. We use OpenWRT and Ubuntu as the OS.

Asterisk is changing the port every 10 mins on the device, I checked with netstat -anp | grep asterisk. In the following example, port 47613 is being used but after 10 mins when the asterisk talks to sip-provider(sip-server) for reregistration/registration-check, the port got changed to 32471.

Example output:
Initially

root@root123:~# netstat -anpt  | grep asterisk
tcp        0      0 0.0.0.0:5060            0.0.0.0:*               LISTEN      8481/asterisk
tcp        0      0 0.0.0.0:5038            0.0.0.0:*               LISTEN      8481/asterisk
tcp        0      0 192.168.55.138:47613     55.122.61.21:5060        ESTABLISHED 8481/asterisk

After 10 mins

root@root123:~# netstat -anpt  | grep asterisk
tcp        0      0 0.0.0.0:5060            0.0.0.0:*               LISTEN      8481/asterisk
tcp        0      0 0.0.0.0:5038            0.0.0.0:*               LISTEN      8481/asterisk
tcp        0      0 192.168.55.138:32471     55.122.61.21:5060        ESTABLISHED 8481/asterisk

After another 10 mins

root@root123:~# netstat -anpt  | grep asterisk
tcp        0      0 0.0.0.0:5060            0.0.0.0:*               LISTEN      8481/asterisk
tcp        0      0 0.0.0.0:5038            0.0.0.0:*               LISTEN      8481/asterisk
tcp        0      0 192.168.55.138:23123     55.122.61.21:5060        ESTABLISHED 8481/asterisk

Questions:

  • Will this affect the VoIP system or calls? Is it a normal behavior?
  • Is it possible to force the asterisk to keep on the same port?

Which SIP channel driver?

In any case, for TCP, I’m not aware of any way, on a Posix system, to reuse the same source port for multiple TCP connections. In fact, the TCP protocol requires the source port to be quarantined for some time before it can be re-used.

As to why there are multiple TCP connections, my guess is that the peer is closing the connection.

Hi @neondal_for_voip1
What you are showing is not Asterisk changing its port - it is the remote peer changing its source port. Asterisk, on the contrary, has an unchanged process ID=8481 and listens on 55.122.61.21:5060.

The fact of changing port should not negatively affect Asterisk behaviour. However, it might be a sign of flapping links, faulty equipment or configuration on the remote side, so that I would not be surprised if the sessions and media streams were broken as well.

Summary: Contact the owner of the remote party and ask him to check equipment and connections.