By default pjsip extensions are configured with directmedia=yes. Now I need to disable this option because I need the RTP streams going through the pbx, but I can’t find any parameter in Freepbx to do it.
Also I tried to find a global parameter in pjsip.conf to disable it but directmedia parameter is only accepted as individual endpoint parameter and I can’t rewrite them because they are automatically generated by Freepbx.
Can you help me?
Direct media defaults to no for trunks. I believe that pjsip is smart enough not to attempt direct media if the call is recorded, transcoded, encrypted, monitored for DTMF or if the extension is behind a NAT.
So you should only see direct media on internal calls with both endpoints on your LAN, when the PBX does not need to monitor the audio at all.
Is direct media being used inappropriately? Or, do you have a special requirement, e.g. capture all packets with tcpdump for later analysis?
I need to capture all RTP packets for recording purposes. I’m using a 3rd party software to record calls capturing SIP and RTP on Asterisk interface.
There is another scenario where is needed disable directmedia. It is when, for example, two extensions belongs to two differents networks not routed between them, in this scenario, with directmedia=yes audio can’t be routed directly between endpoints and is mandatory to go through Asterisk.
Asterisk is a Back to Back User Agent, so all media is routed through the PBX unless specifically directed to use Direct Media. You are asking us how to enable a feature that is the default.
I’ve made several packet captures and I can say that, by default, the media goes directly between endpoints.
I found a workaround configuring direct_media parameter in pjsip.endpoint_custom_post.conf for each endpoint available.
[106](+)
type=endpoint
direct_media=no
After doing this, I can see the change in the endpoint
Now the packet capture shows how the media goes through the asterisk interface.
But it’s not a good solution from an administration point of view.
There is a way to configure it globally? Or using a mask in pjsip.endpoint_custom_post.conf?
Expecting righteous fury here but maybe just use chan_sip it has worked for years, 100% ( some erroneously think it stopped working and you can only use pjsip) and you can stop directmedia easily, I’m sure that pjsip can also do that in FPBX , but so far . . . . (Crickets)
I already used chan_sip in other situations to solve the same issue, but now I also need multiple endpoint registrations under the same sip user feature, only available in pjsip.
I think that it’s easy enough add direct_media configuration to FPBX extension options, I hope FPBX developers will see this need in comming versions.
Do you mean the extension advanced tab? I can’t find any directmedia option in this tab.
In “Settings” --> “Advanced settings” there is an option “SIP canrenivite (directmedia)”, but it only applies to chan_sip extensions, this option doesn’t modify the endpoint pjsip direct_media option in pjsip.endpoint.conf.
I’m using Freepbx 14.0.11 (I think is the newest in 14 branch), and I can’t find the option that you show in your screenshot. In the below screenshot you can see that there isn’t Direct Media option after “Session Timers”.