Orangepi SIP client connecting to an asterisk server does not work

Hello everyone!

  1. I have an Asterisk 20.7.0 server
    Pjsip
    VPS hostgator, public ip

1.1) My settings are these:

[global]
type=global
user_agent=Asterisk
default_realm = <my_domain>
stunaddr = stun.l.google.com:19302
ice_support=yes
keep_alive_interval = 60

[transport-udp-ipv4]
type=transport
protocol=udp
bind=0.0.0.0:11050 (I’m using port 11050)
local_net=192.168.0.0/24 (there is no local network, I just put this ip range as test)
external_media_address=<my_public_ip>
external_signaling_address=<my_public_ip>

[transport-udp-ipv6]
type=transport
protocol=udp
bind=[::]:11050

[transport-tcp-ipv4]
type=transport
protocol=tcp
bind=0.0.0.0:11050
local_ne t=192.168.0.0/24
external_media_address=<my_public_ip>
external_signaling_address=<my_public_ip>

[transport-tcp-ipv6]
type=transport
protocol=tcp
bind=[::]:11050

[ms2024111]
type=endpoint
context=internal
disallow=all
allow=ulaw
allow=alaw
allow=gsm
auth=(no password to facilitate testing)
aors=ms2024111
rewrite_contact=yes
rtp_symmetric=yes
force_rport=yes
direct_media= no

[ms2024111_auth]
type=auth
auth_type=userpass
username=ms2024111
password=1234

[ms2024111]
type=aor
max_contacts=1
remove_existing=yes

[aislan]
type=endpoint
context=internal
disallow=all
allow=ulaw
allow=alaw
allow=gsm
auth=
aors=aislan
rewrite_contact=yes
rtp_symmetric=yes
force_rport=yes
direct_media=no
;ice_support=yes

[aislan_auth]
type=auth
auth_type=userpass
username=aislan
password=1234

[aislan]
type=aor
max_contacts=1
remove_existing=yes

[fernanda]
type=endpoint
context=internal
disallow=all
allow=ulaw
allow=alaw
allow=gsm
auth=
aors=fernanda
rewrite_contact=yes
rtp_symmetric=yes
force_rport=yes
direct_media = node

[fernanda]
type=auth
auth_type=userpass
username=fernanda
password=1234

[fernanda]
type=aor
max_contacts=1
remove_existing=yes

[pcaislan]
type=endpoint
context=internal
disallow=all
allow=ulaw
allow=alaw
allow=gsm
auth=
aors=pcaislan
rewrite_contact=yes
rtp_symmetric=yes
force_rport=yes
direct_media = node

[pcaislan_auth]
type=auth
auth_type=userpass
username=pcaislan
password=1324

[pcaislan]
type=aor
max_contacts=1
remove_existing=yes

[elizandro]
type=endpoint
context=internal
disallow=all
allow=ulaw
allow=alaw
allow=gsm
auth=
aors=elizandro
rewrite_contact=yes
rtp_symmetric=yes
force_rport=yes
direct_media = no

[elizandro_auth]
type=auth
auth_type=userpass
username=elizandro
password=1234

[elizandro]
type=aor
max_contacts=1
remove_existing=yes

  1. On Android phones with the linphone app (I tested it on other apps too), or on computers With software such as Linphone, Zoiper, MicroSIP, I can make unrestricted calls, with good quality, regardless of the type of Internet connection I use (WIFI, 4G). I can make calls without problems between computers and phones, any type of connection.

  2. The problem

I am developing a device that has an Orange PI PC as its central board, on which I run the Debian 10 (Buster) operating system and the Linphone SIP client.

The problem is, I can register on the server, I can make and receive calls, but without receiving audio, since there is no audio transmission, the call always drops after 31 seconds.

Below is a sample of the rtp debug from the asterisk console

Got RTP packet from 179.224.180.148:61511 (type 00, seq 000770, ts 3363336177, len 000160)
Sent RTP P2P packet to 192.168.0.3:7078 (type 00, len 000160)
Got RTP packet from 179.224.180.148:61511 (type 00, seq 000771, ts 3363336337, len 000160)
Sent RTP P2P packet to 192.168.0.3:7078 (type 00, len 000160)
Got RTP packet from 179.224.180.148:61511 (type 00, seq 000772, ts 3363336497, len 000160)

Note that:
179.224.180.148 is the IP of the device I used to call the orangepi
192.168.0.3 is the IP of my orangepi

From what little I understand, for some reason the orangepi is not “passing its public IP to the server”, I don’t know exactly why.

[…]
Attention:

In Asterisk, if I configure the endpoints with
<direct_media = yes>
I can make calls both between devices and to Orangepi, however, only when the calling partners are on the same network. This does not solve the problem, since the Orangepi devices, as well as the person making the call, will always be on different networks.

[…]

  1. What did I try to solve the problem?

4.1) Configure NAT iptables in the operating system, also disable firewall completely

4.2) Configure stun server: stun.l.google.com:19302
4.3) Enable stun and ice server in asterisk

To summarize, I believe that orangepi has some limitation when it comes to NAT, which causes its private IP to reach the server, and not the public one. I believe that is it, because, between computers with Windows, on Android phones, I did tests and the connection, even on different networks, works without problems.

Can someone please help me???