No Audio PJSIP

Hi I’ve FreePBX 15 with Asterisk 16.6.2. I’ve two extensions registered as PJSIP, when they call each other, there is no audio. If they call out side via trunk it works well. Please advise.

Did you specify the local network in the Asterisk SIP Settings?

Yes I did.

Please check this.

Please give us a little more details about the setup

Can you please specify what you needed. Also one more thing there is no media if both PJSIP devices are registered remotely. If both are registered from same network then media works.Attached is PJSIP settings

Is the PBX actually on a public IP? If not, what kind of router/firewall is it behind?

Does it have more than one NIC? Posting the result of
would be useful.

Also, what SIP devices or apps are you using? What kind of router/firewall are they behind? Are there any NAT settings enabled in the devices? Any SIP ALG in the router/firewall?

Yes PBX is actually on Public IP. It has one NIC eth0. I’m using PortSip soft phone. Also if I use SIP extensions works perfect, only issue is on PJSIP.

At the Asterisk command prompt, type
pjsip set logger on
which will include a SIP trace in the regular Asterisk log (Reports -> Asterisk Logfiles).
Make a failing test call between two extensions.
Paste the log at and post the link here.

Hi, here is the pastebin. I called from extension 207 to extension 205. Both are PJSIP.

Can anyone please help on this urgent. I will be really thankful.

Thank You

Not the correct answer, but I seen a while back ago, someone had a public facing install where they had to set Asterisk SIP Settings NAT=YES, in order to get ext to ext calls to work. They also were able to do inbound and outbound, but had issues with the internal extensions until they switched it to YES, worth a try if you are desperate.

I guess that setting is not available on the PJSIP Asterisk settings, only Chan SIP, so that wouldnt help

There is also a NAT setting under Advanced Settings, maybe someone with more knowledge about the Advanced Settings section could elaborate.

Here is latest example with PCAP.

For reasons that I don’t understand, pjsip has decided that the extensions could communicate directly and tried to splice Asterisk out of the path. See packets 12 and 17 of the PCAP.

As a quick test, set all the Recording Options for one of the extensions to Force and retest.

If you still don’t get audio, report whether dialing *43 (echo test) from each of the extensions works.

If setting Force does give you audio, add this to /etc/asterisk/pjsip_custom_post.conf

and if that doesn’t work, try

Restart (not just reload) Asterisk after changing the config files.

Hi Stewart,

I turned recording on and it’s working perfect now. What’s the logic?

Normally, Asterisk relays audio between the parties. If A calls B, then A sends audio to Asterisk and Asterisk sends it to B, and vice-versa.

However, when possible, pjsip attempts to get the parties to communicate directly. This reduces the load on the server, might save bandwidth charges and also reduces latency. In your case, it appears that both parties are in Pakistan and the server is in Japan, so the reduction would be noticeable.

If the call is being recorded, transcoded, monitored for DTMF, decrypted, etc., a direct connection is impossible and pjsip doesn’t attempt it. Otherwise, it analyzes the SIP and SDP and sets up a direct path when appropriate. Apparently, your situation hit a bug where even though the SDP contained private addresses, pjsip mistakenly concluded that the parties could communicate directly.

There are config file settings that should force pjsip to avoid direct connection for endpoints behind NAT, or altogether. See

If you want to get direct connection actually working, you need to set up the endpoints and their router/firewalls so they emulate being on a public IP. With some routers, that’s not even possible. If you have multiple endpoints behind the same NAT, it is usually necessary to assign unique RTP port ranges to each and forward them to the corresponding devices.

IMO, it’s hard to get right and is usually not worth the effort. But if you’re calling from Bangalore to Bangkok and the server is in Bangor, you probably should get it working somehow.


Hi Stewart,

Thanks so much for digging all this. Is there any way to resolve it? Remote user’s normally register soft-phone on their cell phones so no way to play with firewall or router. Whatever need to be done it’s on FreePBX/Asterisk. Is there any option to resolve it?

Thank You

Sorry, I messed up. direct_media is set explicitly for each endpoint so you have to override it.
In /etc/asterisk/pjsip.endpoint_custom_post.conf put


and so on. Restart Asterisk and test.