I have two locations running FreePBX 220.127.116.11 with Asterisk 13.16.
These locations are connected via PJSIP trunk over OpenVPN tunnel built between Asterisk servers.
Therefore, each Asterisk machine has two PJSIP transports: one on a physical interface for local endpoints, the other on a tunnel interface for the trunk.
In the above scenario, SIP signalling works fine, but RTP is not flowing between remote endpoints.
During troubleshooting I noticed that once a connection is established (INVITE -> 200 OK -> ACK), the outgoing Asterisk reinvites the remote Asterisk with SDP of the local endpoint, thus trying to establish the direct media connection.
Of course, this scenario will not work as the remote Asterisk does not know anything about local network.
Adding static routes through tunnel interface will not resolve the issue as tunnelling is performed on the Asterisk servers, not on gateway routers.
I have canreinvite=no in global PJSIP settings on both ends, but this parameter does not help.
I found out that Asterisk supports setting media flow mode per endpoint (parameter direct_media). When I added manually direct_media=no to pjsip.endpoint.conf, I got RTP streams flowing.
However, I have not found a corresponding parameter in FreePBX, extensions. Moreover, FreePBX does not communicate direct_media setting to Asterisk (no such lines in generated pjsip.*.conf files), and the latter treats it as yes according to the defaults.
Having this issue open, I am asking for a piece of adivce on the following:
How can I disable direct media in FreePBX UI on an endpoint / extension level?
If (1) is not possible, how can I disable direct media mode entirely for the whole node - taking into account that canreinvite=no does not work as designed?
I can provide configuration settings, packet traces and other supporting materials upon your request.
Thank you very much in advance.
So, do you admit that setting media mode (direct / pass through) per endpoint is not implemented in FreePBX 13 with PJSIP stack? When I was writing this post, I supposed that I missed some parameter somewhere.
In any case, it is not still clear how should global setting Canreinvite work. Should not it forcibly route all the media through Asterisk and avoid re-invites with direct media in SDP?
There are always two connections for any call, and they can have different options, so setting the options globally wouldn’t necessarily be the best course of action. The fact that the setting is missing from the GUI is probably nothing more than an oversight that you can help rectify by submitting a feature request (since you need the option).
I think you might want to add a “(+)” to the end of your trunk name: “[Trunk name] (+)”. It might not make any difference, but that addition tells the system to add the definitions to context. On the other hand, if it works - don’t mess with it.