No audio or one way audio on android with zoiper / linphone, but all is fine on zoiper on Windows

Hello,

i’m new to asterisk and tried my best to set up my server, and I have a problem to receive call from my SIP line.

Everything was working very fine for weeks, but suddenly : no audio when I receive a phone call, or the caller can hear me (using his cellphone), but I cannot hear him (he is listening a kind of echo of what he is saying.)

I read a lot of topic about audio trouble, and tried to investigate, I think I can see in the log where is the problem, but I have no idea how to solve it. I hope you can help me about it :slight_smile:

Asterisk server is on a VPS, no NAT. Android client or windows client (zoiper / linphone), are either on a wifi network behind a nat, either directly using 4G/5G. Same problem in both (wifi or 4g).

First, what I did :

1. pjsip.conf

(2 local users : 200 and 201, and registration for my SIP line) :

[transport-udp]
type = transport
protocol = udp          ; choisir le protocole utilisé (udp / tcp / tls)
bind = 0.0.0.0:16060    ; changer le port par défaut


;  ====================  UTILISATEUR 1  ====================

[200]
type = endpoint
context = local
disallow = all
allow = g722
allow = ulaw
auth = 200
aors = 200

[200]
type = auth
auth_type = userpass
password = toto
username = 200

[200]
type = aor
max_contacts = 1
qualify_frequency  =  60

;  ====================  UTILISATEUR 2  ====================

[201]
type = endpoint
context = local     
disallow = all        
allow = g722        
allow = ulaw        
auth = 201           
aors = 201           
direct_media = yes 

[201]
type = auth                
auth_type = userpass  
password = tata     
username = 201     

[201]
type = aor                     
max_contacts = 1         
qualify_frequency  =  60 


**; FOR SIP LINE REGISTRATION**

[ovh-trunk]
type=registration
outbound_auth=ovh-auth
server_uri=sip:sbc6.fr.sip.ovh
client_uri=sip:xxxxxxxxxx@sbc6.fr.sip.ovh
retry_interval=60
max_retries=30
expiration=3600

[ovh-auth]
type=auth
auth_type=userpass
username=xxxxxxxxx
password=secret 

[ovh-aor]
type=aor
contact=sip:xxxxxxxxxxx@sbc6.fr.sip.ovh

[ovh-endpoint]
type=endpoint
context=local 
aors=ovh-aor
;auth=ovh-auth
transport=transport-udp
disallow=all
allow=g722
allow=ulaw
allow=alaw

What is working :
someone calls me using his normal smartphone, asterisk receive the call and an exten DIAL my Zopier (200).

If I hangup on zoiper on windows on my PC, it’s working fine, and when I log rtp set debug on I can see something like this :

Got  RTP packet from    91.121.129.145:31266 (type 08, seq 030839, ts 581981323, len 000160)
Sent RTP packet to      82.67.9.77:49353 (type 08, seq 022038, ts 640632, len 000160)
Got  RTP packet from    82.67.9.77:49353 (type 08, seq 050037, ts 1830630439, len 000160)
Sent RTP packet to      91.121.129.145:31266 (type 08, seq 024441, ts 1830630432, len 000160)
Got  RTP packet from    91.121.129.145:31266 (type 08, seq 030840, ts 581981483, len 000160)
Sent RTP packet to      82.67.9.77:49353 (type 08, seq 022039, ts 640792, len 000160)
Got  RTP packet from    82.67.9.77:49353 (type 08, seq 050038, ts 1830630599, len 000160)
Sent RTP packet to      91.121.129.145:31266 (type 08, seq 024442, ts 1830630592, len 000160)
Got  RTP packet from    91.121.129.145:31266 (type 08, seq 030841, ts 581981643, len 000160)
Sent RTP packet to      82.67.9.77:49353 (type 08, seq 022040, ts 640952, len 000160)

everything looks fine.
But when I receive the call on my android phone, since few days or weeks, it suddenly stopped working, no audio or only one way audio, and the log is :

Got  RTP packet from    91.121.129.155:37986 (type 08, seq 002500, ts 1300816139, len 000160)
Sent RTP packet to      192.168.1.91:50476 (type 08, seq 011218, ts 067368, len 000160)
Got  RTP packet from    82.67.9.77:50476 (type 08, seq 000436, ts 2186678056, len 000160)
Sent RTP packet to      91.121.129.155:37986 (type 08, seq 017414, ts 2186678056, len 000160)
Got  RTP packet from    91.121.129.155:37986 (type 08, seq 002501, ts 1300816299, len 000160)
Sent RTP packet to      192.168.1.91:50476 (type 08, seq 011219, ts 067528, len 000160)
Got  RTP packet from    82.67.9.77:50476 (type 08, seq 000437, ts 2186678216, len 000160)
Sent RTP packet to      91.121.129.155:37986 (type 08, seq 017415, ts 2186678216, len 000160)
Got  RTP packet from    91.121.129.155:37986 (type 08, seq 002502, ts 1300816459, len 000160)
Sent RTP packet to      192.168.1.91:50476 (type 08, seq 011220, ts 067688, len 000160)
Got  RTP packet from    82.67.9.77:50476 (type 08, seq 000438, ts 2186678376, len 000160)
Sent RTP packet to      91.121.129.155:37986 (type 08, seq 017416, ts 2186678376, len 000160)

This time I get a local 192.x.x.x IP address on “SentRTP packet to”
So I think this is why I have only one way audio or no audio ?
But I don’t understand why this happened suddenly, and some few days I still have not found anyway to fix it.

I tried to enable stun, ice, r_port… I think I tried all combination in zoiper but nothing worked. My phone and the computer are on the same network.

192.168.1.91 is the local IP of my phone, but why ? I setup a stun server, how can asterisk get it ? why only on android ? (when it was working fine I even didn’t setup stun server, I set up stun few days ago when it stopped working).

And IP 91.121.129.155: no idea what it is.

I hope you could understand my poor english and someone can help me :slight_smile: thank you very much

The remote side says where Asterisk should send audio. It told Asterisk to send it to 192.168.1.91.

Generally you would enable NAT options on the PJSIP endpoint of the remote device:

rtp_symmetric=yes
rewrite_contact=yes

I would have thought the relevant one here would have been rtp-symmetric.

@david551 If an internal IP is appearing in SDP, then it can also appear as the Contact so rewrite_contact is probably a good idea too.