Address already in use

I have installed Asterisk 20.5.2 and not configured anything but only pjsip.conf file i made some changes as per below and not created any extensions or anything but getting error which mentioned below.

; Basic UDP transport
;
[transport-udp]
type=transport
protocol=udp    ;udp,tcp,tls,ws,wss,flow
bind=0.0.0.0

; UDP transport behind NAT
;
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.0.0/24
;external_media_address=203.0.113.1
;external_signaling_address=203.0.113.1

Error:

[Jan 19 20:23:46] ERROR[12363]: res_pjsip/config_transport.c:917 transport_apply: Transport 'transport-udp-nat' could not be started: Address already in use
[Jan 19 20:23:46] ERROR[12363]: res_sorcery_config.c:422 sorcery_config_internal_load: Could not create an object of type 'transport' with id 'transport-udp-nat' from configuration file 'pjsip.conf'
[Jan 19 20:23:46] NOTICE[12363]: sorcery.c:1348 sorcery_object_load: Type 'system' is not reloadable, maintaining previous values

Can anyone guide whats wrong and I have not touch sip.conf file also.

You have configured two transports, both will by default bind to port 5060. You can’t have two transports on the same port.

1 Like

You mean like below I shall configure?

Yes.

Still I’m getting same error. Can I make configuration like below

;[transport-udp]
;type=transport
;protocol=udp ;udp,tcp,tls,ws,wss,flow
;bind=0.0.0.0:5065

; UDP transport behind NAT
;
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0:5060
local_net=192.168.0.0/24
;external_media_address=203.0.113.1
;external_signaling_address=203.0.113.1

I want to make call In LAN and also from outside network.

You can have a single transport, configured with local_net, external_media_address, and external_signaling_address for use on LAN and outside the network. Many many many people do that. Having multiple transports is not necessary for it.

1 Like

Okay thank you if you can help me with some configuration that would be great help. As I’m totally newbie.

Configuration for what? The given transport “transport-udp-nat” is fine generally. It’s up to you to populate the local_net and external options with the correct values.

My following configuration is working fine in local but not able to get registration from outside network My present configuration is

[transport-udp]
type=transport
protocol=udp    ;udp,tcp,tls,ws,wss,flow
bind=0.0.0.0:5062

; UDP transport behind NAT
;
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0:5065
local_net=192.168.0.230/24
external_media_address=87.193.70.149
external_signaling_address=87.193.70.149

Can you guide me where I’m making mistake. I have forwarded 5065 port also in my router.

You haven’t stated what exactly happens. Does the traffic appear at Asterisk? (Does it show up in pjsip set logger on)? If not, then the traffic is not getting to Asterisk.

1 Like

In asterisk console Im not getting any activity when I’m trying to register from my outside network. Nothing is happening. In zoiper I’m giving these details

87.193.70.149:5065
ID: 6001
Pass : 6001

Then that would be outside of Asterisk. Firewall on the system Asterisk is on, firewall elsewhere, port forwarding, public internet, etc.

1 Like

After you guidance everything is working in local and I opened port also below i attached my port status


To                         Action      From
--                         ------      ----
5065                       ALLOW       Anywhere                  
5060                       ALLOW       Anywhere                  
5060/udp                   ALLOW       Anywhere                  
5065/udp                   ALLOW       Anywhere                  
10000:20000/udp            ALLOW       Anywhere                  
5060/tcp                   DENY        Anywhere                  
5065/tcp                   DENY        Anywhere                  
5065 (v6)                  ALLOW       Anywhere (v6)             
5060 (v6)                  ALLOW       Anywhere (v6)             
5060/udp (v6)              ALLOW       Anywhere (v6)             
5065/udp (v6)              ALLOW       Anywhere (v6)             
10000:20000/udp (v6)       ALLOW       Anywhere (v6)             
5060/tcp (v6)              DENY        Anywhere (v6)             
5065/tcp (v6)              DENY        Anywhere (v6)  

Still I’m not able to dial from outside network. In Asterisk Console not showing any activities. All my ports in router forwarded as UDP port.

One more question do I need to do anything in sip.conf file ? As I have seen so many documents are available where some configuration is done in sip.conf file to access from outside network. Kindly guide

Thank you.

On your asterisk box in a terminal run

tcpdump -ni any udp and port 5060

and validate that you see traffic. If not, problem is before your asterisk box

Yes logs are coming from local network but from outside nothing showing.

19:01:07.073798 enp1s0 In  IP 192.168.0.101.33678 > 192.168.0.230.5060: SIP
19:01:22.728825 enp1s0 In  IP 192.168.0.101.33678 > 192.168.0.230.5060: SIP: REGISTER sip:192.168.0.230:5060;transport=UDP SIP/2.0
19:01:22.729624 enp1s0 Out IP 192.168.0.230.5060 > 192.168.0.101.33678: SIP: SIP/2.0 401 Unauthorized
19:01:22.830907 enp1s0 In  IP 192.168.0.101.33678 > 192.168.0.230.5060: SIP: REGISTER sip:192.168.0.230:5060;transport=UDP SIP/2.0
19:01:22.832408 enp1s0 Out IP 192.168.0.230.5060 > 192.168.0.101.33678: SIP: SIP/2.0 200 OK
19:01:37.068177 enp1s0 In  IP 192.168.0.101.33678 > 192.168.0.230.5060: SIP

Delete it. You are not using chan_sip and there is no good reason to use it.

You appear not to have port forwarding enabled on the router.

1 Like

Ports are also forwarded

Provide a log of your registration attempt.

1 Like

In asterisk log I’m not getting any log also for registration from outside network.