Some PJSIP phones behind double NAT can’t receive calls

Hi,

I have an Asterisk instance (16.13.0) running on a VPS. The server has a public IP address and is not behind NAT.

I am having no issues with most phones (including behind NAT and softphones on 4G).

However, I am having issues with phones on one network. The network consists of a 4G dongle in a raspberry pi, and the pi is bridging the network to its Ethernet port, which is then connected to a switch and a wifi AP.

I was having no issues with this setup under a FreePBX 14 instance (Asterisk 13). I recently moved these phones to a bare Asterisk 16 instance, and started having an issue with inbound calls.

After some testing, it seems that the issue was not from switching Asterisk versions; I’m now getting the same issues with the original FreePBX box - but only with PJSIP extensions. All the extensions on the new server are PJSIP, but the old server had some PJSIP and some chan_sip extensions.

So, when PJSIP extensions on this network are called, I get the following:

PUBLIC_IP: Public IP of the server
DID: Number dialled
EXTEN: Extension number of endpoint
CONTEXT: The context
NETWORK_PUBLIC_IP: Public IP of the NATed network
NETWORK_PRIVATE_IP: What the network sees as its public IP (due to double NAT)

Setting global variable 'SIPDOMAIN' to 'PUBLIC_IP'
    -- Executing [DID@from-external:1] Dial("PJSIP/all-main-00000098", "LOCAL/EXTEN@CONTEXT") in new stack
    -- Called LOCAL/EXTEN@CONTEXT
    -- Executing [EXTEN@CONTEXT:1] Dial("Local/EXTEN@CONTEXT-00000034;2", "PJSIP/EXTEN/sip:EXTEN@NETWORK_PUBLIC_IP:17953;x-ast-orig-host=NETWORK_PRIVATE_IP:0,20") in new stack
    -- Called PJSIP/EXTEN/sip:EXTEN@NETWORK_PUBLIC_IP:17953;x-ast-orig-host=NETWORK_PRIVATE_IP:0
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [EXTEN@CONTEXT:2] Hangup("Local/EXTEN@CONTEXT-00000034;2", "") in new stack
  == Spawn extension (CONTEXT, EXTEN, 2) exited non-zero on 'Local/EXTEN@CONTEXT-00000034;2'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Auto fallthrough, channel 'PJSIP/all-main-00000098' status is 'CHANUNAVAIL'

Here are the relevant parts of my pjsip.conf:


[pjsip-trans-udp]
type=transport
protocol=udp
bind=PUBLIC_IP:5060
external_media_address=PUBLIC_IP
external_signaling_address=PUBLIC_IP
tos=cs3
cos=3

...

[extensions](!)
type=endpoint
disallow=all
allow=ulaw
dtmf_mode=rfc4733
direct_media=yes
aggregate_mwi=yes
use_avpf=no
rtcp_mux=no
ice_support=no
media_use_received_transport=no
trust_id_inbound=yes
user_eq_phone=no
send_connected_line=yes
media_encryption=no
timers=yes
media_encryption_optimistic=no
rtp_timeout=30
rtp_timeout_hold=300
send_pai=yes
rtp_symmetric=yes
rewrite_contact=yes
force_rport=yes

...

[CONTEXT](!,extensions)
context=CONTEXT

[EXTEN](CONTEXT)
auth=EXTEN
aors=EXTEN

[EXTEN](auth_userpass)
username=EXTEN
password=PASS

[EXTEN]
type=aor
max_contacts=1
minimum_expiration=30
qualify_frequency=60
remove_existing=yes

And my extensions.conf:

...
[from-external]
...
exten => DID,1,Dial(LOCAL/EXTEN@CONTEXT)

...

exten => EXTEN,1,Dial(${PJSIP_DIAL_CONTACTS(EXTEN)},20)
exten => EXTEN,2,Hangup

Let me know if you need any other information.

Thank you in advance!

If you turn up the logging, the underlying problem that resulted in a 0,0,1 (channel unavailable) status will have been logged.

@david551 When I turn up the logs (running asterisk -rvvvvvvvvvvv or core set verbose 10) I get the same logs.

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