# Asterisk port/network issue

**URL:** <https://community.asterisk.org/t/asterisk-port-network-issue/77523>\
**Category:** Asterisk SIP\
**Created:** [December 7, 2018, 1:36am UTC](https://community.asterisk.org/t/asterisk-port-network-issue/77523 "2018-12-07T01:36:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neondal\_for\_voip1](https://avatars.discourse-cdn.com/v4/letter/n/8baadc/32.png) [@neondal\_for\_voip1](https://community.asterisk.org/u/neondal_for_voip1)\
**Post date:** [December 7, 2018, 1:36am UTC](https://community.asterisk.org/t/asterisk-port-network-issue/77523/1 "2018-12-07T01:36:22Z")

</div>

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** _

```auto
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** _

```auto
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** _

```auto
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?

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [December 7, 2018, 10:17am UTC](https://community.asterisk.org/t/asterisk-port-network-issue/77523/2 "2018-12-07T10:17:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pentium-5](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/pentium-5/32/1721_2.png) [@Pentium-5](https://community.asterisk.org/u/Pentium-5)\
**Post date:** [December 7, 2018, 12:15pm UTC](https://community.asterisk.org/t/asterisk-port-network-issue/77523/3 "2018-12-07T12:15:34Z")

</div>

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.
