PJSIP direct_media

Hello!

I have a problem with PJSIP option “direct_media=yes”. It doesn`t work for me.

Call flow: serv_A → serv_B → serv_C

serv_A and serv_b are behind NAT (everything works well)

On serv_B i have a configuration for serv_C like this:

type=wizard
accepts_registrations=no
sends_registrations=no
accepts_auth=no
sends_auth=no
endpoint/allow=!all,ulaw,alaw
endpoint/direct_media=yes
endpoint/direct_media_method=reinvite
endpoint/connected_line_method=update
endpoint/force_rport=yes
endpoint/rtp_symmetric=yes
;endpoint/rewrite_contact=yes
endpoint/context=to-robot
endpoint/from_domain=17.XX.XX.XX
aor/qualify_frequency=30
aor/max_contacts=2
aor/remove_existing=yes

But the media goes trough the serv_B. Can anyone help me?

You’d have to look at the actual debug output and environment to see why it didn’t occur. Just enabling the option doesn’t cause it to happen, conditions also have to be right. Same codec, same packetization, no Local channels, some other things.

Thanks! I understand you. The calls don`t have a LocalChannel. Codecs the same.

SDP between serv_A and serv_B:

SDP between serv_B and serv_C:

The process for collecting debug information is documented on the wiki[1]. As part of bridging calls the module will state why it can’t do direct media in the debug. I will say though, that, if they aren’t behind the same NAT then it’s probably not going to work and you’re in for a world of no audio and pain.

[1] Collecting Debug Information - Asterisk Project - Asterisk Project Wiki

If obfuscating addresses, it is is important to distinguish between different addresses and to distinguish between private and public address ranges.

Lots of things inhibit direct media and there is far too little information here to exclude all of them.

Server B doesn’t appear to be Asterisk, yet that is the one that would actually initiate direct media, given that server A and server C only handle one leg each. Direct media is only possible, by definition, if the call has both A and B legs. Why are you are asking on an Asterisk about how to configure your session border controller?

Server A will honour a direct media request initiated by Server B regardless of its own direct media setting. Conversely, it will never send media directly to C unless B asks it to do so.

One can’t tell if direct media is in use in the A to C direction without the SDP replies.