Asterisk 16.6.2 installed behind NAT and client is also behind NAT

Hi

I have an asterisk 16.6.2 installed behind NAT and my client is also behind NAT but when I am dialing 100 extension from peer 8000 as per dial plan call should run MOH application
but before that it is giving below error, any idea what am I missing?

[Dec 27 07:50:31] ERROR[30457]: res_pjsip.c:3460 ast_sip_set_tpselector_from_transport_name: Unable to retrieve PJSIP transport ‘UDP-NAT’

Below are my pjsip configuration

[UDP-NAT]
type=transport
protocol=udp
bind=0.0.0.0
local_net=172.10.0.0/24
external_media_address=134.150.158.161
external_signaling_address=134.150.158.161

[8000]
type=endpoint
context=from-external
disallow=all
allow=ulaw;alaw;g729
transport=UDP-NAT
auth=8000
aors=8000
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes ; necessary if endpoint does not know/register public ip:port
ice_support=yes ;This is specific to clients that support NAT traversal
;for media via ICE,STUN,TURN. See the wiki at:
;https://wiki.asterisk.org/wiki/x/D4FHAQ
;for a deeper explanation of this topic.

[8000]
type=auth
auth_type=userpass
password=sunny007
username=8000

[8000]
type=aor
max_contacts=4

extensions.conf
exten => 100,1,MOH(default,100)

At startup does the console output show anything regarding the UDP-NAT transport? Does it appear in the CLI when you use the “pjsip show transports” CLI command?

It is showing only UDP

Transport: <TransportId…> <BindAddress…>

Transport: transport-udp udp 0 0 0.0.0.0:5060

Objects found: 1

You can not have two transports bound to the same thing.

Oh I see…So do i need to disable UDP one?

Yes, or edit it to include NAT related options such as external_media_address, local_net, and external_signaling_address.

Now I disabled it but now

adsl-172-10-0-22*CLI> pjsip show transports
No objects found.

below is my config now

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

; UDP transport behind NAT
;
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=172.10.0.0/24
local_net=127.0.0.1/32
external_media_address=X.X.X.X
external_signaling_address=X.X.X.X

Did you check the console log at startup to see what happened when it attempted to load the configuration?

Nothing related to transport while reloading asterisk

Did you restart, or did you reload? You really need to restart when messing with transports.

I restarted asterisk’s service too

Yes logs saying ->
[Jan 2 12:16:36] ERROR[25519] res_pjsip/config_transport.c: Transport ‘transport-udp-nat’ could not be started: Address already in use
[Jan 2 12:16:36] ERROR[25519] res_sorcery_config.c: Could not create an object of type ‘transport’ with id ‘transport-udp-nat’ from configuration file ‘pjsip.conf’

Something is still bound to 0.0.0.0 port 5060 then.

Oh Ok, but how do I check or debug further more …May be i can see after increasing the level of debug…

From the perspective of PJSIP debug won’t really change it. We ask the system to bind to “0.0.0.0 port 5060” and it merely says something is already listening, it doesn’t state what. You have to figure that out yourself. For example: Is chan_sip loaded? That will by default bind to it.

Thanks, I dont know how I ignored chan_sip…so after reloading of chan_sip…it worked finally

Ideally chan_sip should not be loaded if I work with pjsip…right?

If you don’t plan on using chan_sip then there is no reason to have it loaded.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.