Pass the RTP coming from Media Relay Server directly to the endpoint

Hi all,

Is there any way that I can configure FreePBX to “proxy” the RTP streams coming from an upstream Carrier?

Example: Endpoint 1000 (another PBX) → FreePBX → PJSIP Trunk with Carrier → Upstream Carrier OR Upstream Carrier → PJSIP Trunk → FreePBX → PBX with ext. 1000.

By default, my PJSIP Carrier will give me the RTP Server in the SDP from the 200 OK coming from their side. What I want to achieve it’s to pass this directly to the endpoint and not pass it through FreePBX.

Is there any way that I enable/disable this for an extension? I don’t want to make this a global setting.

There is no ability to do this at call setup time. There is only the ability for Asterisk to re-INVITE afterwards to have media go directly which is enabled using the direct_media option HOWEVER it requires conditions to be absolutely perfect. No feature that would require media involvement has to be used. No DTMF features, no transcoding, no Local channels.

Hi @jcolp,

Thanks for your reply!

And how could I achieve this? Could you point me to a KB or a tutorial?

Thank you!

you will need a real SIP proxy before your FreePBX and do it there. Perhaps

So in order for the direct_media to work, I need a “SBC” before, that would act as a SIP Proxy?

I’m asking because I’m testing right now with an extension on the FreePBX where I disabled the Direct Media, and still FreePBX it’s sending it’s own IP Address in the SDP c= field, instead of the endpoint’s c= that it’s sent into the 200OK.

You don’t disable direct media. You enable it.

I don’t have anything in regards to FreePBX for the specific configuration required to do this.

As well, as I stated this would be a re-INVITE after the call is established. It would not happen in the initial INVITE or 200 OK.

Asterisk is a B2BUA , it can bridge an input channel with an output channel but it just can’t ‘proxy’

To be more specific, it won’t act as a proxy for SIP signaling and SDP. Each side is generally independent.

Note that both endpoints must have Direct Media enabled.

I assume that the remote PBX is configured as a trunk on your PBX. If not, please explain.

What device? To work, it must be on a public IP address or have NAT mapping set up so it exactly emulates being on a public IP. This usually requires the NAT router to forward the device’s RTP port range to the device.

But it can never be ‘directly to the endpoint’ as the op asked for, reasons are already posted.

Google B2BUA vs. SIP proxy

Asterisk has special case handling for SIP which allows it to take itself out the media path. Whilst normally everything goes through the Asterisk core, and its SIPness is lost in the process, if both parties use the same SIP channel driver and other conditions are met, there are two further options, a native bridging mode, in which the RTP is forwarded packet for packet, and an external bridging mode (direct media) in which the SDP gives the direct address to the next hop.

In practice, direct media is difficult on FreePBX, because the default configuration supports feature codes, which require the media to pass through Asterisk. Also, many people want to record calls, and, when it comes to queues, FreePBX tends to use local channels.

It’s not just queues. Everything in FreePBX uses Local Channels. With FreePBX it’s almost impossible to get out of the media because of the use of Local Channels everywhere.

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