Asterisk with 4G : RTP sent to a private address

Hello everyone,
I am new to Asterisk and this forum was very helpful for setting it up.
But there is an issue I can’t solve : Asterisk with 4G-LTE/mobile data.
Here is the part of my PJSIP endpoint :

rewrite_contact = yes
direct_media = no
force_rport = yes
rtp_symmetric = yes

And here is my pjsip.conf :


type = transport
protocol = udp
bind =
local_net =
external_media_address = my_external_ip
external_signaling_address = my_external_ip

When I call from my local wifi/rj45, there is no problem.
When I call from another network, no problem, it works.
But when I call from 4G (with the same device) there is no audio.

When I set RTP debug on, we can see thet RTP packets are sent to 10.x.x.x, I think that’s the issue.

How can I “force” Asterisk to send RTP packets to my 4G IP?
When I register my softphone, the CLI is showing the correct IP.
Thanks a lot for your help

Is Asterisk receiving the packets in “rtp set debug on”? If not, then it won’t switch and has no idea where media should really go.

This is a continuation of

No packets received, just sent.

Sent RTP packet to (type 09, seq 002828, ts 014080, len 000160)
Sent RTP packet to (type 09, seq 002829, ts 014240, len 000160)
Sent RTP packet to (type 09, seq 002830, ts 014400, len 000160)
Sent RTP packet to (type 09, seq 002831, ts 014560, len 000160)
Sent RTP packet to (type 09, seq 002832, ts 014720, len 000160)
Sent RTP packet to (type 09, seq 002833, ts 014880, len 000160)
Sent RTP packet to (type 09, seq 002834, ts 015040, len 000160)
Sent RTP packet to (type 09, seq 002835, ts 015200, len 000160)
Sent RTP packet to (type 09, seq 002836, ts 015360, len 000160)
Sent RTP packet to (type 09, seq 002837, ts 015520, len 000160)

I heard about STUN or something like that, but I don’t know how to set it up. Is it on my server ?

STUN is not a panacea and, once you know your router, you (usually) no longer need the protocol. It also depends on what the other side is doing. If “connected media” (comedia) is used, the problem is also solved. If you are dealing with “port restricted NAT”, STUN and Comedia amount to pretty much the same thing, since the connections are initiated by your own server anyway.

That said, you could post a SIP trace of such a call and I am not sure whether your local_net def is right. It may be better not to define anything here, but you’d know what defines you LAN.

The OP has done the common trick of starting a new thread when he didn’t get an answer he liked. The suggestion for STUN was for the phone configuration, as the phone is sending private media addresses, but isn’t sending any media that Asterisk could use to make comedia work. Moreover, the OP said there was no way of configuring the public address on the phone.

There is an open question of why the phone isn’t sending media, but attempts to talk though checking whether Asterisk is sending a public address didn’t produce a response. It may be that the phone has a policy of never being the first to send media, which would obviously rule out comedia at the Asterisk end.

The router that is at immediate issue is the one used by the mobile network operator, so outside the OPs control.

I see. So every path is basically double NAT. The own router could be a pain in the neck and service provider’s is a black box. I’d try an OpenVPN tunnel into my own LAN, but performance could be an issue.

Thanks for your help!
So after changing the softphone it works perfectly!
If someone has the same issue, use Zoiper on iOS and Android, it works perfectly for me.

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